Updating cache to 1 hour.
This commit is contained in:
parent
0e84430307
commit
7be0dad245
|
@ -8,6 +8,8 @@ exports.CacheKeys = {
|
||||||
|
|
||||||
exports.TTL = {
|
exports.TTL = {
|
||||||
ONE_MINUTE: 600,
|
ONE_MINUTE: 600,
|
||||||
|
ONE_HOUR: 3600,
|
||||||
|
ONE_DAY: 86400,
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTenantKey(key) {
|
function generateTenantKey(key) {
|
||||||
|
|
|
@ -256,62 +256,58 @@ exports.configChecklist = async function (ctx) {
|
||||||
const tenantId = getTenantId()
|
const tenantId = getTenantId()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ctx.body = await withCache(
|
ctx.body = await withCache(CacheKeys.CHECKLIST, TTL.ONE_HOUR, async () => {
|
||||||
CacheKeys.CHECKLIST,
|
let apps = []
|
||||||
TTL.ONE_MINUTE,
|
if (!env.MULTI_TENANCY || tenantId) {
|
||||||
async () => {
|
// Apps exist
|
||||||
let apps = []
|
apps = await getAllApps({ idsOnly: true, efficient: true })
|
||||||
if (!env.MULTI_TENANCY || tenantId) {
|
|
||||||
// Apps exist
|
|
||||||
apps = await getAllApps({ idsOnly: true, efficient: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
// They have set up SMTP
|
|
||||||
const smtpConfig = await getScopedFullConfig(db, {
|
|
||||||
type: Configs.SMTP,
|
|
||||||
})
|
|
||||||
|
|
||||||
// They have set up Google Auth
|
|
||||||
const googleConfig = await getScopedFullConfig(db, {
|
|
||||||
type: Configs.GOOGLE,
|
|
||||||
})
|
|
||||||
|
|
||||||
// They have set up OIDC
|
|
||||||
const oidcConfig = await getScopedFullConfig(db, {
|
|
||||||
type: Configs.OIDC,
|
|
||||||
})
|
|
||||||
|
|
||||||
// They have set up an global user
|
|
||||||
const users = await db.allDocs(
|
|
||||||
getGlobalUserParams(null, {
|
|
||||||
include_docs: true,
|
|
||||||
limit: 1,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
return {
|
|
||||||
apps: {
|
|
||||||
checked: apps.length > 0,
|
|
||||||
label: "Create your first app",
|
|
||||||
link: "/builder/portal/apps",
|
|
||||||
},
|
|
||||||
smtp: {
|
|
||||||
checked: !!smtpConfig,
|
|
||||||
label: "Set up email",
|
|
||||||
link: "/builder/portal/manage/email",
|
|
||||||
},
|
|
||||||
adminUser: {
|
|
||||||
checked: users && users.rows.length >= 1,
|
|
||||||
label: "Create your first user",
|
|
||||||
link: "/builder/portal/manage/users",
|
|
||||||
},
|
|
||||||
sso: {
|
|
||||||
checked: !!googleConfig || !!oidcConfig,
|
|
||||||
label: "Set up single sign-on",
|
|
||||||
link: "/builder/portal/manage/auth",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
// They have set up SMTP
|
||||||
|
const smtpConfig = await getScopedFullConfig(db, {
|
||||||
|
type: Configs.SMTP,
|
||||||
|
})
|
||||||
|
|
||||||
|
// They have set up Google Auth
|
||||||
|
const googleConfig = await getScopedFullConfig(db, {
|
||||||
|
type: Configs.GOOGLE,
|
||||||
|
})
|
||||||
|
|
||||||
|
// They have set up OIDC
|
||||||
|
const oidcConfig = await getScopedFullConfig(db, {
|
||||||
|
type: Configs.OIDC,
|
||||||
|
})
|
||||||
|
|
||||||
|
// They have set up an global user
|
||||||
|
const users = await db.allDocs(
|
||||||
|
getGlobalUserParams(null, {
|
||||||
|
include_docs: true,
|
||||||
|
limit: 1,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
apps: {
|
||||||
|
checked: apps.length > 0,
|
||||||
|
label: "Create your first app",
|
||||||
|
link: "/builder/portal/apps",
|
||||||
|
},
|
||||||
|
smtp: {
|
||||||
|
checked: !!smtpConfig,
|
||||||
|
label: "Set up email",
|
||||||
|
link: "/builder/portal/manage/email",
|
||||||
|
},
|
||||||
|
adminUser: {
|
||||||
|
checked: users && users.rows.length >= 1,
|
||||||
|
label: "Create your first user",
|
||||||
|
link: "/builder/portal/manage/users",
|
||||||
|
},
|
||||||
|
sso: {
|
||||||
|
checked: !!googleConfig || !!oidcConfig,
|
||||||
|
label: "Set up single sign-on",
|
||||||
|
link: "/builder/portal/manage/auth",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(err.status, err)
|
ctx.throw(err.status, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue