Linting and fixing an issue with the dev pass through.

This commit is contained in:
mike12345567 2021-05-24 16:20:02 +01:00
parent b7f739d54a
commit 7e6f215598
3 changed files with 10 additions and 13 deletions

View File

@ -4,17 +4,12 @@ const Redis = env.isTest() ? require("ioredis-mock") : require("ioredis")
const { addDbPrefix, removeDbPrefix, getRedisOptions } = require("./utils") const { addDbPrefix, removeDbPrefix, getRedisOptions } = require("./utils")
const RETRY_PERIOD_MS = 2000 const RETRY_PERIOD_MS = 2000
const MAX_RETRIES = 20
const CLUSTERED = false const CLUSTERED = false
// for testing just generate the client once // for testing just generate the client once
let CONNECTED = false let CONNECTED = false
let CLIENT = env.isTest() ? new Redis(getRedisOptions()) : null let CLIENT = env.isTest() ? new Redis(getRedisOptions()) : null
function retryConnection() {
setTimeout(init, RETRY_PERIOD_MS)
}
/** /**
* Inits the system, will error if unable to connect to redis cluster (may take up to 10 seconds) otherwise * Inits the system, will error if unable to connect to redis cluster (may take up to 10 seconds) otherwise
* will return the ioredis client which will be ready to use. * will return the ioredis client which will be ready to use.

View File

@ -23,7 +23,16 @@ async function redirect(ctx, method) {
if (cookie) { if (cookie) {
ctx.set("set-cookie", cookie) ctx.set("set-cookie", cookie)
} }
let body
try {
body = await response.json()
} catch (err) {
// don't worry about errors, likely no JSON
}
ctx.status = response.status ctx.status = response.status
if (body) {
ctx.body = body
}
ctx.cookies ctx.cookies
} }

View File

@ -6,10 +6,8 @@ const {
getGlobalUserParams, getGlobalUserParams,
getScopedFullConfig, getScopedFullConfig,
} = require("@budibase/auth").db } = require("@budibase/auth").db
const fetch = require("node-fetch")
const { Configs } = require("../../../constants") const { Configs } = require("../../../constants")
const email = require("../../../utilities/email") const email = require("../../../utilities/email")
const env = require("../../../environment")
const { upload, ObjectStoreBuckets } = require("@budibase/auth").objectStore const { upload, ObjectStoreBuckets } = require("@budibase/auth").objectStore
const APP_PREFIX = "app_" const APP_PREFIX = "app_"
@ -155,12 +153,7 @@ exports.configChecklist = async function (ctx) {
// TODO: Watch get started video // TODO: Watch get started video
// Apps exist // Apps exist
let allDbs let allDbs = await CouchDB.allDbs()
if (env.COUCH_DB_URL) {
allDbs = await (await fetch(`${env.COUCH_DB_URL}/_all_dbs`)).json()
} else {
allDbs = await CouchDB.allDbs()
}
const appDbNames = allDbs.filter(dbName => dbName.startsWith(APP_PREFIX)) const appDbNames = allDbs.filter(dbName => dbName.startsWith(APP_PREFIX))
// They have set up SMTP // They have set up SMTP