231841a2 by Adam Heath

Adjustment to the environment reading, so that *all* settings can be

overridden, not just the OIDC values.
1 parent fbed7b0c
import 'dotenv/config'
import oidcMiddleware, { fileStoreOptions } from './oidc-middleware.mjs'
import { oidcParams } from './options.mjs'
import { allParams } from './options.mjs'
const clientLocalsSymbol = Symbol.for("astro.locals")
......@@ -9,7 +9,7 @@ export default (options) => {
name: 'session',
hooks: {
'astro:server:setup': async ({ server }) => {
server.middlewares.use(await oidcMiddleware({ oidc: oidcParams() }, fileStoreOptions))
server.middlewares.use(await oidcMiddleware(fileStoreOptions, allParams()))
server.middlewares.use((req, res, next) => {
req[ clientLocalsSymbol ] = res.locals
next()
......
export { default as FixRacyStore } from './fix-racy-store.mjs'
export { default as oidcMiddleware, fileStoreOptions } from './oidc-middleware.mjs'
export { readEnvOptions, oidcParams } from './options.mjs'
export { readEnvOptions, oidcParams, authParams, sessionParams, allParams } from './options.mjs'
export { default as AstroIntegration } from './astro-integration.mjs'
......
......@@ -62,7 +62,7 @@ const parseRawToken = (rawToken, def) => {
export default async (...options) => {
options = merge({}, defaultOptions, ...options)
console.log('options', options.oidc)
console.log('options', options)
const app = express.Router()
const sessionStore = await options.session.store(options)
......
......@@ -20,4 +20,10 @@ export const oidcParams = () => _.pickBy(_.merge({
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(),
})
......