diff --git a/packages/server/src/api/controllers/deploy/aws.js b/packages/server/src/api/controllers/deploy/aws.js index 3414ebcac7..0eec46b984 100644 --- a/packages/server/src/api/controllers/deploy/aws.js +++ b/packages/server/src/api/controllers/deploy/aws.js @@ -4,6 +4,7 @@ const AWS = require("aws-sdk") const fetch = require("node-fetch") const { budibaseAppsDir } = require("../../../utilities/budibaseDir") const PouchDB = require("../../../db") +const environment = require("../../../environment") async function invalidateCDN(cfDistribution, appId) { const cf = new AWS.CloudFront({}) @@ -24,7 +25,7 @@ async function invalidateCDN(cfDistribution, appId) { exports.updateDeploymentQuota = async function(quota) { const DEPLOYMENT_SUCCESS_URL = - process.env.DEPLOYMENT_CREDENTIALS_URL + "deploy/success" + environment.DEPLOYMENT_CREDENTIALS_URL + "deploy/success" const response = await fetch(DEPLOYMENT_SUCCESS_URL, { method: "POST", diff --git a/packages/server/src/api/controllers/deploy/index.js b/packages/server/src/api/controllers/deploy/index.js index 2b433140fe..93ac080e19 100644 --- a/packages/server/src/api/controllers/deploy/index.js +++ b/packages/server/src/api/controllers/deploy/index.js @@ -5,6 +5,7 @@ const { verifyDeployment, updateDeploymentQuota, } = require("./aws") +const { DocumentTypes } = require("../../../db/utils") function replicate(local, remote) { return new Promise((resolve, reject) => { @@ -38,8 +39,12 @@ async function replicateCouch({ instanceId, clientId, credentials }) { async function getCurrentInstanceQuota(instanceId) { const db = new PouchDB(instanceId) const records = await db.allDocs({ - startkey: "record:", - endkey: `record:\ufff0`, + startkey: "re:", + endkey: `re:\ufff0`, + }) + const users = await db.allDocs({ + startkey: DocumentTypes.USER + , + endkey: `us:\ufff0`, }) const existingRecords = records.rows.length diff --git a/packages/server/src/db/utils.js b/packages/server/src/db/utils.js index 8405f97210..83a0f35605 100644 --- a/packages/server/src/db/utils.js +++ b/packages/server/src/db/utils.js @@ -14,6 +14,8 @@ exports.DocumentTypes = DocumentTypes const UNICODE_MAX = "\ufff0" +exports.UNICODE_MAX = UNICODE_MAX + /** * If creating DB allDocs/query params with only a single top level ID this can be used, this * is usually the case as most of our docs are top level e.g. models, automations, users and so on.