code review
This commit is contained in:
parent
c9f791f250
commit
c885382225
|
@ -4,6 +4,7 @@ const AWS = require("aws-sdk")
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
const { budibaseAppsDir } = require("../../../utilities/budibaseDir")
|
const { budibaseAppsDir } = require("../../../utilities/budibaseDir")
|
||||||
const PouchDB = require("../../../db")
|
const PouchDB = require("../../../db")
|
||||||
|
const environment = require("../../../environment")
|
||||||
|
|
||||||
async function invalidateCDN(cfDistribution, appId) {
|
async function invalidateCDN(cfDistribution, appId) {
|
||||||
const cf = new AWS.CloudFront({})
|
const cf = new AWS.CloudFront({})
|
||||||
|
@ -24,7 +25,7 @@ async function invalidateCDN(cfDistribution, appId) {
|
||||||
|
|
||||||
exports.updateDeploymentQuota = async function(quota) {
|
exports.updateDeploymentQuota = async function(quota) {
|
||||||
const DEPLOYMENT_SUCCESS_URL =
|
const DEPLOYMENT_SUCCESS_URL =
|
||||||
process.env.DEPLOYMENT_CREDENTIALS_URL + "deploy/success"
|
environment.DEPLOYMENT_CREDENTIALS_URL + "deploy/success"
|
||||||
|
|
||||||
const response = await fetch(DEPLOYMENT_SUCCESS_URL, {
|
const response = await fetch(DEPLOYMENT_SUCCESS_URL, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
@ -5,6 +5,7 @@ const {
|
||||||
verifyDeployment,
|
verifyDeployment,
|
||||||
updateDeploymentQuota,
|
updateDeploymentQuota,
|
||||||
} = require("./aws")
|
} = require("./aws")
|
||||||
|
const { DocumentTypes } = require("../../../db/utils")
|
||||||
|
|
||||||
function replicate(local, remote) {
|
function replicate(local, remote) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -38,8 +39,12 @@ async function replicateCouch({ instanceId, clientId, credentials }) {
|
||||||
async function getCurrentInstanceQuota(instanceId) {
|
async function getCurrentInstanceQuota(instanceId) {
|
||||||
const db = new PouchDB(instanceId)
|
const db = new PouchDB(instanceId)
|
||||||
const records = await db.allDocs({
|
const records = await db.allDocs({
|
||||||
startkey: "record:",
|
startkey: "re:",
|
||||||
endkey: `record:\ufff0`,
|
endkey: `re:\ufff0`,
|
||||||
|
})
|
||||||
|
const users = await db.allDocs({
|
||||||
|
startkey: DocumentTypes.USER + ,
|
||||||
|
endkey: `us:\ufff0`,
|
||||||
})
|
})
|
||||||
const existingRecords = records.rows.length
|
const existingRecords = records.rows.length
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ exports.DocumentTypes = DocumentTypes
|
||||||
|
|
||||||
const UNICODE_MAX = "\ufff0"
|
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
|
* 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.
|
* is usually the case as most of our docs are top level e.g. models, automations, users and so on.
|
||||||
|
|
Loading…
Reference in New Issue