Default public config.config when missing
This commit is contained in:
parent
806957e462
commit
5f51de257f
|
@ -125,7 +125,7 @@ exports.publicOidc = async function (ctx) {
|
||||||
|
|
||||||
exports.publicSettings = async function (ctx) {
|
exports.publicSettings = async function (ctx) {
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
let config = {}
|
|
||||||
try {
|
try {
|
||||||
// Find the config with the most granular scope based on context
|
// Find the config with the most granular scope based on context
|
||||||
const publicConfig = await getScopedFullConfig(db, {
|
const publicConfig = await getScopedFullConfig(db, {
|
||||||
|
@ -140,20 +140,19 @@ exports.publicSettings = async function (ctx) {
|
||||||
type: Configs.OIDC,
|
type: Configs.OIDC,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Slightly complex logic here to deal with the fact that
|
let config = {}
|
||||||
// oidc / google might be enabled but org name etc (publicConfig) might not
|
if (!publicConfig) {
|
||||||
if (publicConfig && !!googleConfig && !!oidcConfig) {
|
config = {
|
||||||
ctx.body = publicConfig
|
config: {},
|
||||||
} else if (!publicConfig && !!googleConfig && !!oidcConfig) {
|
|
||||||
ctx.body = {}
|
|
||||||
} else {
|
|
||||||
if (publicConfig) {
|
|
||||||
config.config = publicConfig.config
|
|
||||||
}
|
}
|
||||||
config.config.oidc = !!oidcConfig
|
} else {
|
||||||
config.config.google = !!googleConfig
|
config = publicConfig
|
||||||
ctx.body = config
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.config.oidc = !!oidcConfig
|
||||||
|
config.config.google = !!googleConfig
|
||||||
|
|
||||||
|
ctx.body = config
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(err.status, err)
|
ctx.throw(err.status, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue