Skip to content

Commit

Permalink
Updated getConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rorylshanks committed Mar 22, 2024
1 parent 56251ae commit 578ca9a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import metrics from '../util/metrics.js'
import { randomUUID } from 'node:crypto'
import admin from './adminpage.js'

const config = getConfig()

var trusted_ranges = ["loopback"].concat(getConfig().trusted_ranges || [])
var trusted_ranges = ["loopback"].concat(config.trusted_ranges || [])
log.debug({ message: `Setting trusted proxies to ${trusted_ranges}` })
app.set('trust proxy', trusted_ranges)

Expand All @@ -27,10 +28,10 @@ app.use(
store: redisHelper.getRedisStore(),
resave: false,
saveUninitialized: false,
secret: getConfig().cookie_secret,
secret: config.cookie_secret,
cookie: {
...defaultCookieOptions,
...getConfig().cookie_settings
...config.cookie_settings
}
})
)
Expand All @@ -43,13 +44,13 @@ const getPublicKeyFromPrivateKey = (privateKeyPem) => {
};

function generateJwks() {
let signing_key = getConfig().signing_key
let signing_key = config.signing_key
let buff = Buffer.from(signing_key, 'base64');
let pemPrivateKey = buff.toString('ascii');
const pemPublicKey = getPublicKeyFromPrivateKey(pemPrivateKey);
jwks = pem2jwk(pemPublicKey);
jwks.kid = getConfig().kid_override || "0"
jwks.alg = getConfig().signing_key_algorithm || "RS256"
jwks.kid = config.kid_override || "0"
jwks.alg = config.signing_key_algorithm || "RS256"
jwks.use = "sig"
}

Expand Down Expand Up @@ -100,7 +101,7 @@ app.get(redirectBasePath + '/logout', async (req, res) => {
app.get(redirectBasePath + '/auth', ssoController.redirectToSsoProvider)
app.get(redirectBasePath + '/callback', ssoController.verifySsoCallback)

app.get(getConfig().jwks_path, (req, res) => {
app.get(config.jwks_path, (req, res) => {
res.json({
keys: [jwks],
});
Expand Down

0 comments on commit 578ca9a

Please sign in to comment.