changed "master" databse to "clientAppLookup"
This commit is contained in:
parent
eddda1d675
commit
6cb7e995a2
|
@ -36,7 +36,7 @@ exports.create = async function(ctx) {
|
||||||
}
|
}
|
||||||
const appId = newid()
|
const appId = newid()
|
||||||
// insert an appId -> clientId lookup
|
// insert an appId -> clientId lookup
|
||||||
const masterDb = new CouchDB("master")
|
const masterDb = new CouchDB("clientAppLookup")
|
||||||
await masterDb.put({
|
await masterDb.put({
|
||||||
_id: appId,
|
_id: appId,
|
||||||
clientId,
|
clientId,
|
||||||
|
@ -113,7 +113,7 @@ const createEmptyAppPackage = async (ctx, app) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const lookupClientId = async appId => {
|
const lookupClientId = async appId => {
|
||||||
const masterDb = new CouchDB("master")
|
const masterDb = new CouchDB("clientAppLookup")
|
||||||
const { clientId } = await masterDb.get(appId)
|
const { clientId } = await masterDb.get(appId)
|
||||||
return clientId
|
return clientId
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ exports.authenticate = async ctx => {
|
||||||
if (!username) ctx.throw(400, "Username Required.")
|
if (!username) ctx.throw(400, "Username Required.")
|
||||||
if (!password) ctx.throw(400, "Password Required")
|
if (!password) ctx.throw(400, "Password Required")
|
||||||
|
|
||||||
const masterDb = new CouchDB("master")
|
const masterDb = new CouchDB("clientAppLookup")
|
||||||
const { clientId } = await masterDb.get(ctx.params.appId)
|
const { clientId } = await masterDb.get(ctx.params.appId)
|
||||||
|
|
||||||
if (!clientId) {
|
if (!clientId) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ const {
|
||||||
} = require("../../utilities/budibaseDir")
|
} = require("../../utilities/budibaseDir")
|
||||||
|
|
||||||
exports.fetchAppComponentDefinitions = async function(ctx) {
|
exports.fetchAppComponentDefinitions = async function(ctx) {
|
||||||
const masterDb = new CouchDB("master")
|
const masterDb = new CouchDB("clientAppLookup")
|
||||||
const { clientId } = await masterDb.get(ctx.params.appId)
|
const { clientId } = await masterDb.get(ctx.params.appId)
|
||||||
const db = new CouchDB(ClientDb.name(clientId))
|
const db = new CouchDB(ClientDb.name(clientId))
|
||||||
const app = await db.get(ctx.params.appId)
|
const app = await db.get(ctx.params.appId)
|
||||||
|
|
|
@ -8,7 +8,7 @@ exports.create = async function(ctx) {
|
||||||
const instanceId = `inst_${appShortId}_${newid()}`
|
const instanceId = `inst_${appShortId}_${newid()}`
|
||||||
const { applicationId } = ctx.params
|
const { applicationId } = ctx.params
|
||||||
|
|
||||||
const masterDb = new CouchDB("master")
|
const masterDb = new CouchDB("clientAppLookup")
|
||||||
const { clientId } = await masterDb.get(applicationId)
|
const { clientId } = await masterDb.get(applicationId)
|
||||||
|
|
||||||
const db = new CouchDB(instanceId)
|
const db = new CouchDB(instanceId)
|
||||||
|
|
|
@ -41,7 +41,7 @@ exports.create = async function(ctx) {
|
||||||
|
|
||||||
const response = await database.post(user)
|
const response = await database.post(user)
|
||||||
|
|
||||||
const masterDb = new CouchDB("master")
|
const masterDb = new CouchDB("clientAppLookup")
|
||||||
const { clientId } = await masterDb.get(appId)
|
const { clientId } = await masterDb.get(appId)
|
||||||
|
|
||||||
// the clientDB needs to store a map of users against the app
|
// the clientDB needs to store a map of users against the app
|
||||||
|
|
Loading…
Reference in New Issue