Making the URL optional for application creation/update in OpenAPI spec, removing unused parameter and fixing getRedisOptions function to work with fully qualified URLs.
This commit is contained in:
parent
06db377b31
commit
30651e81d5
|
@ -22,12 +22,25 @@ exports.Databases = {
|
||||||
exports.SEPARATOR = SEPARATOR
|
exports.SEPARATOR = SEPARATOR
|
||||||
|
|
||||||
exports.getRedisOptions = (clustered = false) => {
|
exports.getRedisOptions = (clustered = false) => {
|
||||||
const [host, port, ...rest] = REDIS_URL.split(":")
|
let password = REDIS_PASSWORD
|
||||||
|
let url = REDIS_URL.split("//")
|
||||||
|
// get rid of the protocol
|
||||||
|
url = url.length > 1 ? url[1] : url[0]
|
||||||
|
// check for a password etc
|
||||||
|
url = url.split("@")
|
||||||
|
if (url.length > 1) {
|
||||||
|
// get the password
|
||||||
|
password = url[0].split(":")[1]
|
||||||
|
url = url[1]
|
||||||
|
} else {
|
||||||
|
url = url[0]
|
||||||
|
}
|
||||||
|
const [host, port] = url.split(":")
|
||||||
|
|
||||||
let redisProtocolUrl
|
let redisProtocolUrl
|
||||||
|
|
||||||
// fully qualified redis URL
|
// fully qualified redis URL
|
||||||
if (rest.length && /rediss?/.test(host)) {
|
if (/rediss?/.test(REDIS_URL)) {
|
||||||
redisProtocolUrl = REDIS_URL
|
redisProtocolUrl = REDIS_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +50,13 @@ exports.getRedisOptions = (clustered = false) => {
|
||||||
if (clustered) {
|
if (clustered) {
|
||||||
opts.redisOptions = {}
|
opts.redisOptions = {}
|
||||||
opts.redisOptions.tls = {}
|
opts.redisOptions.tls = {}
|
||||||
opts.redisOptions.password = REDIS_PASSWORD
|
opts.redisOptions.password = password
|
||||||
opts.slotsRefreshTimeout = SLOT_REFRESH_MS
|
opts.slotsRefreshTimeout = SLOT_REFRESH_MS
|
||||||
opts.dnsLookup = (address, callback) => callback(null, address)
|
opts.dnsLookup = (address, callback) => callback(null, address)
|
||||||
} else {
|
} else {
|
||||||
opts.host = host
|
opts.host = host
|
||||||
opts.port = port
|
opts.port = port
|
||||||
opts.password = REDIS_PASSWORD
|
opts.password = password
|
||||||
}
|
}
|
||||||
return { opts, host, port, redisProtocolUrl }
|
return { opts, host, port, redisProtocolUrl }
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,8 +437,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"name",
|
"name"
|
||||||
"url"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"applicationOutput": {
|
"applicationOutput": {
|
||||||
|
@ -1803,11 +1802,6 @@
|
||||||
"tags": [
|
"tags": [
|
||||||
"applications"
|
"applications"
|
||||||
],
|
],
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"$ref": "#/components/parameters/appId"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"required": true,
|
"required": true,
|
||||||
"content": {
|
"content": {
|
||||||
|
|
|
@ -309,7 +309,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
- url
|
|
||||||
applicationOutput:
|
applicationOutput:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -1346,8 +1345,6 @@ paths:
|
||||||
applications.
|
applications.
|
||||||
tags:
|
tags:
|
||||||
- applications
|
- applications
|
||||||
parameters:
|
|
||||||
- $ref: "#/components/parameters/appId"
|
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
|
|
|
@ -27,7 +27,7 @@ const base = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const applicationSchema = object(base, { required: ["name", "url"] })
|
const applicationSchema = object(base, { required: ["name"] })
|
||||||
|
|
||||||
const applicationOutputSchema = object(
|
const applicationOutputSchema = object(
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,8 +121,6 @@ read.push(new Endpoint("get", "/applications/:appId", controller.read))
|
||||||
* description: Based on application properties (currently only name) search for applications.
|
* description: Based on application properties (currently only name) search for applications.
|
||||||
* tags:
|
* tags:
|
||||||
* - applications
|
* - applications
|
||||||
* parameters:
|
|
||||||
* - $ref: '#/components/parameters/appId'
|
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
|
@ -85,12 +85,6 @@ export interface paths {
|
||||||
"/applications/search": {
|
"/applications/search": {
|
||||||
/** Based on application properties (currently only name) search for applications. */
|
/** Based on application properties (currently only name) search for applications. */
|
||||||
post: {
|
post: {
|
||||||
parameters: {
|
|
||||||
header: {
|
|
||||||
/** The ID of the app which this request is targeting. */
|
|
||||||
"x-budibase-app-id": components["parameters"]["appId"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
responses: {
|
responses: {
|
||||||
/** Returns the applications that were found based on the search parameters. */
|
/** Returns the applications that were found based on the search parameters. */
|
||||||
200: {
|
200: {
|
||||||
|
@ -554,7 +548,7 @@ export interface components {
|
||||||
/** @description The name of the app. */
|
/** @description The name of the app. */
|
||||||
name: string;
|
name: string;
|
||||||
/** @description The URL by which the app is accessed, this must be URL encoded. */
|
/** @description The URL by which the app is accessed, this must be URL encoded. */
|
||||||
url: string;
|
url?: string;
|
||||||
};
|
};
|
||||||
applicationOutput: {
|
applicationOutput: {
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Reference in New Issue