Merge pull request #14137 from Budibase/fix/sql-url-dev-only-default
Fix for default CouchDB SQL URL
This commit is contained in:
commit
bd2bbe4c0c
|
@ -25,7 +25,10 @@ export const getCouchInfo = (connection?: string) => {
|
|||
}
|
||||
const authCookie = Buffer.from(`${username}:${password}`).toString("base64")
|
||||
let sqlUrl = env.COUCH_DB_SQL_URL
|
||||
if (!sqlUrl && urlInfo.url) {
|
||||
// default for dev
|
||||
if (env.isDev() && !sqlUrl) {
|
||||
sqlUrl = "http://localhost:4006"
|
||||
} else if (!sqlUrl && urlInfo.url) {
|
||||
const parsed = new URL(urlInfo.url)
|
||||
// attempt to connect on default port
|
||||
sqlUrl = urlInfo.url.replace(parsed.port, "4984")
|
||||
|
|
|
@ -114,7 +114,7 @@ const environment = {
|
|||
ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,
|
||||
API_ENCRYPTION_KEY: getAPIEncryptionKey(),
|
||||
COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005",
|
||||
COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL || "http://localhost:4006",
|
||||
COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL,
|
||||
SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
|
||||
SQS_SEARCH_ENABLE_TENANTS:
|
||||
process.env.SQS_SEARCH_ENABLE_TENANTS?.split(",") || [],
|
||||
|
|
|
@ -28,7 +28,6 @@ const DEFAULTS = {
|
|||
PLUGINS_DIR: "/plugins",
|
||||
FORKED_PROCESS_NAME: "main",
|
||||
JS_RUNNER_MEMORY_LIMIT: 64,
|
||||
COUCH_DB_SQL_URL: "http://localhost:4006",
|
||||
}
|
||||
|
||||
const QUERY_THREAD_TIMEOUT =
|
||||
|
@ -44,7 +43,7 @@ const environment = {
|
|||
// important - prefer app port to generic port
|
||||
PORT: process.env.APP_PORT || process.env.PORT,
|
||||
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
||||
COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL || DEFAULTS.COUCH_DB_SQL_URL,
|
||||
COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL,
|
||||
MINIO_URL: process.env.MINIO_URL,
|
||||
WORKER_URL: process.env.WORKER_URL,
|
||||
AWS_REGION: process.env.AWS_REGION,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Ctx, MaintenanceType } from "@budibase/types"
|
||||
import env from "../../../environment"
|
||||
import { env as coreEnv } from "@budibase/backend-core"
|
||||
import { env as coreEnv, db as dbCore } from "@budibase/backend-core"
|
||||
import nodeFetch from "node-fetch"
|
||||
|
||||
let sqsAvailable: boolean
|
||||
|
@ -12,7 +12,12 @@ async function isSqsAvailable() {
|
|||
}
|
||||
|
||||
try {
|
||||
await nodeFetch(coreEnv.COUCH_DB_SQL_URL, {
|
||||
const couchInfo = dbCore.getCouchInfo()
|
||||
if (!couchInfo.sqlUrl) {
|
||||
sqsAvailable = false
|
||||
return false
|
||||
}
|
||||
await nodeFetch(couchInfo.sqlUrl, {
|
||||
timeout: 1000,
|
||||
})
|
||||
sqsAvailable = true
|
||||
|
|
Loading…
Reference in New Issue