couchdb direct auth
This commit is contained in:
parent
892970234b
commit
769c37a11d
|
@ -168,7 +168,13 @@ exports.getAllDbs = async () => {
|
||||||
if (env.isTest()) {
|
if (env.isTest()) {
|
||||||
return getCouch().allDbs()
|
return getCouch().allDbs()
|
||||||
}
|
}
|
||||||
const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`)
|
const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
name: env.COUCH_DB_USERNAME,
|
||||||
|
password: env.COUCH_DB_PASSWORD,
|
||||||
|
}),
|
||||||
|
})
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
return response.json()
|
return response.json()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,7 +36,7 @@ async function init() {
|
||||||
const envFileJson = {
|
const envFileJson = {
|
||||||
PORT: 4001,
|
PORT: 4001,
|
||||||
MINIO_URL: "http://localhost:10000/",
|
MINIO_URL: "http://localhost:10000/",
|
||||||
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
COUCH_DB_URL: "http://localhost:10000/db/",
|
||||||
REDIS_URL: "localhost:6379",
|
REDIS_URL: "localhost:6379",
|
||||||
WORKER_URL: "http://localhost:4002",
|
WORKER_URL: "http://localhost:4002",
|
||||||
INTERNAL_API_KEY: "budibase",
|
INTERNAL_API_KEY: "budibase",
|
||||||
|
|
|
@ -12,6 +12,10 @@ PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
|
||||||
|
|
||||||
let POUCH_DB_DEFAULTS = {
|
let POUCH_DB_DEFAULTS = {
|
||||||
prefix: COUCH_DB_URL,
|
prefix: COUCH_DB_URL,
|
||||||
|
auth: {
|
||||||
|
username: env.COUCH_DB_USERNAME,
|
||||||
|
password: env.COUCH_DB_PASSWORD,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env.isTest()) {
|
if (env.isTest()) {
|
||||||
|
|
|
@ -23,6 +23,8 @@ module.exports = {
|
||||||
// important
|
// important
|
||||||
PORT: process.env.PORT,
|
PORT: process.env.PORT,
|
||||||
JWT_SECRET: process.env.JWT_SECRET,
|
JWT_SECRET: process.env.JWT_SECRET,
|
||||||
|
COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
|
||||||
|
COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
|
||||||
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
||||||
MINIO_URL: process.env.MINIO_URL,
|
MINIO_URL: process.env.MINIO_URL,
|
||||||
WORKER_URL: process.env.WORKER_URL,
|
WORKER_URL: process.env.WORKER_URL,
|
||||||
|
|
|
@ -17,7 +17,7 @@ async function init() {
|
||||||
REDIS_URL: "localhost:6379",
|
REDIS_URL: "localhost:6379",
|
||||||
REDIS_PASSWORD: "budibase",
|
REDIS_PASSWORD: "budibase",
|
||||||
MINIO_URL: "http://localhost:10000/",
|
MINIO_URL: "http://localhost:10000/",
|
||||||
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
COUCH_DB_URL: "http://localhost:10000/db/",
|
||||||
}
|
}
|
||||||
let envFile = ""
|
let envFile = ""
|
||||||
Object.keys(envFileJson).forEach(key => {
|
Object.keys(envFileJson).forEach(key => {
|
||||||
|
|
|
@ -7,6 +7,10 @@ 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: {
|
||||||
|
username: env.COUCH_DB_USERNAME,
|
||||||
|
password: env.COUCH_DB_PASSWORD,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env.isTest()) {
|
if (env.isTest()) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ module.exports = {
|
||||||
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
||||||
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
||||||
MINIO_URL: process.env.MINIO_URL,
|
MINIO_URL: process.env.MINIO_URL,
|
||||||
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
|
||||||
LOG_LEVEL: process.env.LOG_LEVEL,
|
LOG_LEVEL: process.env.LOG_LEVEL,
|
||||||
JWT_SECRET: process.env.JWT_SECRET,
|
JWT_SECRET: process.env.JWT_SECRET,
|
||||||
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
||||||
|
@ -31,7 +30,7 @@ module.exports = {
|
||||||
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
||||||
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
||||||
/* TODO: to remove - once deployment removed */
|
/* TODO: to remove - once deployment removed */
|
||||||
COUCH_DB_USERNAME: process.env.COUCH_DB_USERNAME,
|
COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
|
||||||
COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
|
COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
|
||||||
_set(key, value) {
|
_set(key, value) {
|
||||||
process.env[key] = value
|
process.env[key] = value
|
||||||
|
|
Loading…
Reference in New Issue