Skip to content

Commit 45fb548

Browse files
committed
fix: gateway accept numeric passphrase
1 parent 31d0e36 commit 45fb548

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gateway/src/services/config-manager-cert-passphrase.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ export namespace ConfigManagerCertPassphrase {
1010
};
1111

1212
export const readPassphrase = (): string | undefined => {
13-
if (argvParser(process.argv)[PASSPHRASE_ARGUMENT]) {
14-
return argvParser(process.argv)[PASSPHRASE_ARGUMENT];
13+
const argv = argvParser(process.argv, { string: [PASSPHRASE_ARGUMENT] });
14+
if (argv[PASSPHRASE_ARGUMENT]) {
15+
return argv[PASSPHRASE_ARGUMENT];
1516
} else if (process.env[PASSPHRASE_ENV]) {
1617
return process.env[PASSPHRASE_ENV];
1718
}

gateway/test/services/config-manager-cert-passphrase.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ describe('ConfigManagerCertPassphrase.readPassphrase', () => {
3636
expect(certPhrase).toEqual(passphrase);
3737
delete process.env['GATEWAY_PASSPHRASE'];
3838
});
39+
40+
it('should accept numeric cert phrase', async () => {
41+
const passphrase = '12345';
42+
process.env['GATEWAY_PASSPHRASE'] = passphrase;
43+
const certPhrase = ConfigManagerCertPassphrase.readPassphrase();
44+
expect(certPhrase).toEqual(passphrase);
45+
delete process.env['GATEWAY_PASSPHRASE'];
46+
});
3947
});

0 commit comments

Comments
 (0)