From f9c4175bae4790ddc54a0f6d5fc79be9d29d5519 Mon Sep 17 00:00:00 2001 From: lelemm Date: Mon, 11 Nov 2024 13:34:20 -0300 Subject: [PATCH] Update src/load-config.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/load-config.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/load-config.js b/src/load-config.js index abbde5a10..0df11b227 100644 --- a/src/load-config.js +++ b/src/load-config.js @@ -154,6 +154,22 @@ const finalConfig = { const baseConfig = process.env.ACTUAL_OPENID_DISCOVERY_URL ? { issuer: process.env.ACTUAL_OPENID_DISCOVERY_URL } : { + ...(() => { + const required = { + authorization_endpoint: process.env.ACTUAL_OPENID_AUTHORIZATION_ENDPOINT, + token_endpoint: process.env.ACTUAL_OPENID_TOKEN_ENDPOINT, + userinfo_endpoint: process.env.ACTUAL_OPENID_USERINFO_ENDPOINT, + }; + const missing = Object.entries(required) + .filter(([_, value]) => !value) + .map(([key]) => key); + if (missing.length > 0) { + throw new Error( + `Missing required OpenID configuration: ${missing.join(', ')}` + ); + } + return {}; + })(), issuer: { name: process.env.ACTUAL_OPENID_PROVIDER_NAME, authorization_endpoint: