1
0
Fork 0
mirror of synced 2024-10-01 09:38:55 +13:00

changed "master" databse to "clientAppLookup"

This commit is contained in:
Michael Shanks 2020-06-11 10:12:01 +01:00
parent 735d9c4475
commit 108fa4ca13
5 changed files with 6 additions and 6 deletions

View file

@ -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
} }

View file

@ -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) {

View file

@ -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)

View file

@ -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)

View file

@ -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