Merge pull request #4571 from Budibase/deprovision-and-couch-fix
Deprovision and local couch db url fix
This commit is contained in:
commit
496ed45c11
|
@ -1,5 +1,5 @@
|
||||||
const { getGlobalUserParams, getAllApps } = require("../db/utils")
|
const { getGlobalUserParams, getAllApps } = require("../db/utils")
|
||||||
const { getDB, getCouch } = require("../db")
|
const { getDB } = require("../db")
|
||||||
const { getGlobalDB } = require("../tenancy")
|
const { getGlobalDB } = require("../tenancy")
|
||||||
const { StaticDatabases } = require("../db/constants")
|
const { StaticDatabases } = require("../db/constants")
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ const removeGlobalDB = async tenantId => {
|
||||||
|
|
||||||
const removeTenantApps = async tenantId => {
|
const removeTenantApps = async tenantId => {
|
||||||
try {
|
try {
|
||||||
const apps = await getAllApps(getCouch(), { all: true })
|
const apps = await getAllApps({ all: true })
|
||||||
const destroyPromises = apps.map(app => getDB(app.appId).destroy())
|
const destroyPromises = apps.map(app => getDB(app.appId).destroy())
|
||||||
await Promise.allSettled(destroyPromises)
|
await Promise.allSettled(destroyPromises)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ exports.getMigrationsDoc = async db => {
|
||||||
if (err.status && err.status === 404) {
|
if (err.status && err.status === 404) {
|
||||||
return { _id: DocumentTypes.MIGRATIONS }
|
return { _id: DocumentTypes.MIGRATIONS }
|
||||||
}
|
}
|
||||||
|
console.error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ async function init() {
|
||||||
const envFileJson = {
|
const envFileJson = {
|
||||||
PORT: 4001,
|
PORT: 4001,
|
||||||
MINIO_URL: "http://localhost:4004",
|
MINIO_URL: "http://localhost:4004",
|
||||||
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
COUCH_DB_URL: "http://budibase:budibase@localhost:4005",
|
||||||
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",
|
||||||
|
|
|
@ -5,7 +5,7 @@ const allDbs = require("pouchdb-all-dbs")
|
||||||
const find = require("pouchdb-find")
|
const find = require("pouchdb-find")
|
||||||
const env = require("../environment")
|
const env = require("../environment")
|
||||||
|
|
||||||
const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/"
|
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005"
|
||||||
|
|
||||||
PouchDB.plugin(replicationStream.plugin)
|
PouchDB.plugin(replicationStream.plugin)
|
||||||
PouchDB.plugin(find)
|
PouchDB.plugin(find)
|
||||||
|
|
|
@ -16,7 +16,7 @@ async function init() {
|
||||||
REDIS_URL: "localhost:6379",
|
REDIS_URL: "localhost:6379",
|
||||||
REDIS_PASSWORD: "budibase",
|
REDIS_PASSWORD: "budibase",
|
||||||
MINIO_URL: "http://localhost:4004",
|
MINIO_URL: "http://localhost:4004",
|
||||||
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
COUCH_DB_URL: "http://budibase:budibase@localhost:4005",
|
||||||
COUCH_DB_USERNAME: "budibase",
|
COUCH_DB_USERNAME: "budibase",
|
||||||
COUCH_DB_PASSWORD: "budibase",
|
COUCH_DB_PASSWORD: "budibase",
|
||||||
// empty string is false
|
// empty string is false
|
||||||
|
|
|
@ -4,7 +4,7 @@ const env = require("../environment")
|
||||||
const { getCouchUrl } = require("@budibase/backend-core/db")
|
const { getCouchUrl } = require("@budibase/backend-core/db")
|
||||||
|
|
||||||
// level option is purely for testing (development)
|
// level option is purely for testing (development)
|
||||||
const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/"
|
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005"
|
||||||
|
|
||||||
let POUCH_DB_DEFAULTS = {
|
let POUCH_DB_DEFAULTS = {
|
||||||
prefix: COUCH_DB_URL,
|
prefix: COUCH_DB_URL,
|
||||||
|
|
Loading…
Reference in New Issue