options.mjs
693 Bytes
import { default as _ } from 'lodash'
import { readEnv } from 'read-env'
export const readEnvOptions = {
source: process.env,
separator: '__',
format: 'camelcase',
sanitize: {
object: false,
array: false,
bool: true,
'int': true,
'float': true,
},
}
export const oidcParams = () => _.pickBy(_.merge({
//bearerOnly: true,
}, readEnv('OIDC', readEnvOptions)), (value, key) => {
return !_.startsWith(key, 'http')
})
export const authParams = () => readEnv('AUTH', readEnvOptions)
export const sessionParams = () => readEnv('SESSION', readEnvOptions)
export const allParams = () => ({
auth: authParams(),
session: sessionParams(),
oidc: oidcParams(),
})