Revert "Feature/couchdb auth"

This commit is contained in:
Martin McKeaveney 2021-08-17 07:16:43 +01:00 committed by GitHub
parent 0cc16ee5c2
commit 8e1e016c66
8 changed files with 5 additions and 30 deletions

View File

@ -159,17 +159,6 @@ exports.getDeployedAppID = appId => {
return appId return appId
} }
exports.getCouchUrl = () => {
// username and password already exist in URL
if (env.COUCH_DB_URL.includes("@")) {
return env.COUCH_DB_URL
}
const [protocol, ...rest] = env.COUCH_DB_URL.split("://")
return `${protocol}://${env.COUCH_DB_USERNAME}:${env.COUCH_DB_PASSWORD}@${rest}`
}
/** /**
* if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing * if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing
* when using Pouch it will use the pouchdb-all-dbs package. * when using Pouch it will use the pouchdb-all-dbs package.
@ -179,7 +168,7 @@ exports.getAllDbs = async () => {
if (env.isTest()) { if (env.isTest()) {
return getCouch().allDbs() return getCouch().allDbs()
} }
const response = await fetch(`${exports.getCouchUrl()}/_all_dbs`) const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`)
if (response.status === 200) { if (response.status === 200) {
return response.json() return response.json()
} else { } else {

View File

@ -9,8 +9,6 @@ function isTest() {
module.exports = { module.exports = {
JWT_SECRET: process.env.JWT_SECRET, JWT_SECRET: process.env.JWT_SECRET,
COUCH_DB_URL: process.env.COUCH_DB_URL, COUCH_DB_URL: process.env.COUCH_DB_URL,
COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
SALT_ROUNDS: process.env.SALT_ROUNDS, SALT_ROUNDS: process.env.SALT_ROUNDS,
REDIS_URL: process.env.REDIS_URL, REDIS_URL: process.env.REDIS_URL,
REDIS_PASSWORD: process.env.REDIS_PASSWORD, REDIS_PASSWORD: process.env.REDIS_PASSWORD,

View File

@ -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://localhost:10000/db/", COUCH_DB_URL: "http://budibase:budibase@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",

View File

@ -1,6 +1,6 @@
const { SearchIndexes } = require("../../../db/utils") const { SearchIndexes } = require("../../../db/utils")
const env = require("../../../environment")
const fetch = require("node-fetch") const fetch = require("node-fetch")
const { getCouchUrl } = require("@budibase/auth/db")
/** /**
* Class to build lucene query URLs. * Class to build lucene query URLs.
@ -233,9 +233,7 @@ class QueryBuilder {
} }
async run() { async run() {
const url = `${getCouchUrl()}/${this.appId}/_design/database/_search/${ const url = `${env.COUCH_DB_URL}/${this.appId}/_design/database/_search/${SearchIndexes.ROWS}`
SearchIndexes.ROWS
}`
const body = this.buildSearchBody() const body = this.buildSearchBody()
return await runQuery(url, body) return await runQuery(url, body)
} }

View File

@ -12,10 +12,6 @@ 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()) {

View File

@ -23,8 +23,6 @@ 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,

View File

@ -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://localhost:10000/db/", COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
} }
let envFile = "" let envFile = ""
Object.keys(envFileJson).forEach(key => { Object.keys(envFileJson).forEach(key => {

View File

@ -7,10 +7,6 @@ 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()) {