mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
fix: openId.issuer config not loading from env vars (#6061)
* fix: openId.issuer config loading from env vars * add release note * [autofix.ci] apply automated fixes * remove unused directive * move test to the right place * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -177,7 +177,6 @@ export async function run() {
|
||||
const openIdConfig = config?.getProperties()?.openId;
|
||||
if (
|
||||
openIdConfig?.discoveryURL ||
|
||||
// @ts-expect-error FIXME no types for config yet
|
||||
openIdConfig?.issuer?.authorization_endpoint
|
||||
) {
|
||||
console.log('OpenID configuration found. Preparing server to use it');
|
||||
|
||||
@@ -205,8 +205,7 @@ const configSchema = convict({
|
||||
},
|
||||
issuer: {
|
||||
doc: 'OpenID issuer',
|
||||
format: Object,
|
||||
default: {},
|
||||
|
||||
name: {
|
||||
doc: 'Name of the provider',
|
||||
default: '',
|
||||
|
||||
@@ -110,3 +110,32 @@ describe('tokenExpiration format', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('config schema', () => {
|
||||
it('should parse nested object from environment variables correctly', () => {
|
||||
const authorizationEndpoint =
|
||||
'https://testprovider.com/.well-known/openid-configuration';
|
||||
process.env.TEST_OPENID_AUTHORIZATION_ENDPOINT = authorizationEndpoint;
|
||||
|
||||
const testSchema = convict({
|
||||
openId: {
|
||||
doc: 'OpenID authentication settings.',
|
||||
|
||||
issuer: {
|
||||
doc: 'OpenID issuer',
|
||||
|
||||
authorization_endpoint: {
|
||||
doc: 'Authorization endpoint',
|
||||
default: '',
|
||||
format: String,
|
||||
env: 'TEST_OPENID_AUTHORIZATION_ENDPOINT',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(() => testSchema.validate()).not.toThrow();
|
||||
expect(testSchema.get('openId.issuer.authorization_endpoint')).toBe(
|
||||
authorizationEndpoint,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
6
upcoming-release-notes/6061.md
Normal file
6
upcoming-release-notes/6061.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [lwschan]
|
||||
---
|
||||
|
||||
fix: openId.issuer config not loading from env vars
|
||||
Reference in New Issue
Block a user