making checklist cache length controllable through env var
This commit is contained in:
parent
518797295e
commit
e1bacb7cca
|
@ -17,7 +17,6 @@ const { googleCallbackUrl, oidcCallbackUrl } = require("./auth")
|
|||
const {
|
||||
withCache,
|
||||
CacheKeys,
|
||||
TTL,
|
||||
bustCache,
|
||||
} = require("@budibase/backend-core/cache")
|
||||
|
||||
|
@ -256,7 +255,10 @@ exports.configChecklist = async function (ctx) {
|
|||
const tenantId = getTenantId()
|
||||
|
||||
try {
|
||||
ctx.body = await withCache(CacheKeys.CHECKLIST, TTL.ONE_HOUR, async () => {
|
||||
ctx.body = await withCache(
|
||||
CacheKeys.CHECKLIST,
|
||||
env.CHECKLIST_CACHE_TTL,
|
||||
async () => {
|
||||
let apps = []
|
||||
if (!env.MULTI_TENANCY || tenantId) {
|
||||
// Apps exist
|
||||
|
@ -307,7 +309,8 @@ exports.configChecklist = async function (ctx) {
|
|||
link: "/builder/portal/manage/auth",
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
} catch (err) {
|
||||
ctx.throw(err.status, err)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const { join } = require("path")
|
||||
const { TTL } = require("@budibase/backend-core/cache")
|
||||
|
||||
function isDev() {
|
||||
return process.env.NODE_ENV !== "production"
|
||||
|
@ -52,7 +53,8 @@ module.exports = {
|
|||
SMTP_FROM_ADDRESS: process.env.SMTP_FROM_ADDRESS,
|
||||
PLATFORM_URL: process.env.PLATFORM_URL,
|
||||
COOKIE_DOMAIN: process.env.COOKIE_DOMAIN,
|
||||
CHECKLIST_CACHE_TTL: parseIntSafe(process.env.CHECKLIST_CACHE_TTL) || 600,
|
||||
CHECKLIST_CACHE_TTL:
|
||||
parseIntSafe(process.env.CHECKLIST_CACHE_TTL) || TTL.ONE_HOUR,
|
||||
APPS_URL: process.env.APPS_URL,
|
||||
_set(key, value) {
|
||||
process.env[key] = value
|
||||
|
|
Loading…
Reference in New Issue