Merge pull request #2394 from Budibase/fix/check-for-couch-creds

conditionally apply username and password to couchdb auth
This commit is contained in:
Martin McKeaveney 2021-08-17 16:57:04 +01:00 committed by GitHub
commit 7bca33e53d
2 changed files with 10 additions and 4 deletions

View File

@ -12,10 +12,13 @@ PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
let POUCH_DB_DEFAULTS = { let POUCH_DB_DEFAULTS = {
prefix: COUCH_DB_URL, prefix: COUCH_DB_URL,
auth: { }
if (env.COUCH_DB_USERNAME && env.COUCH_DB_PASSWORD) {
POUCH_DB_DEFAULTS.auth = {
username: env.COUCH_DB_USERNAME, username: env.COUCH_DB_USERNAME,
password: env.COUCH_DB_PASSWORD, password: env.COUCH_DB_PASSWORD,
}, }
} }
if (env.isTest()) { if (env.isTest()) {

View File

@ -7,10 +7,13 @@ const COUCH_DB_URL = env.COUCH_DB_URL || "http://localhost:10000/db/"
let POUCH_DB_DEFAULTS = { let POUCH_DB_DEFAULTS = {
prefix: COUCH_DB_URL, prefix: COUCH_DB_URL,
auth: { }
if (env.COUCH_DB_USERNAME && env.COUCH_DB_PASSWORD) {
POUCH_DB_DEFAULTS.auth = {
username: env.COUCH_DB_USERNAME, username: env.COUCH_DB_USERNAME,
password: env.COUCH_DB_PASSWORD, password: env.COUCH_DB_PASSWORD,
}, }
} }
if (env.isTest()) { if (env.isTest()) {