Skip to content

Commit 6790897

Browse files
committed
fixup! fixup! feat(ncu-config): add support for partially encrypted config files
1 parent 2fd21f1 commit 6790897

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/auth.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ async function auth(
114114
}
115115
};
116116
if (options.github) {
117-
const config = getMergedConfig();
117+
let config;
118+
try {
119+
config = getMergedConfig();
120+
} catch {
121+
config = {};
122+
}
118123
if (!Object.hasOwn(config, 'token') || !Object.hasOwn(config, 'username')) {
119124
process.stdout.write(
120125
'If this is your first time running this command, ' +

test/fixtures/run-auth-github.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ async function mockCredentials(options) {
1616
(async function() {
1717
const { default: auth } = await import('../../lib/auth.js');
1818
const authParams = await auth({ github: true }, mockCredentials);
19+
if (typeof authParams === 'object' && authParams != null) {
20+
for (const key of Object.getOwnPropertyNames(authParams)) {
21+
if (key !== 'github') delete authParams[key];
22+
}
23+
}
1924
process.stdout.write(`${JSON.stringify(authParams)}\n`);
2025
})().catch(err => {
2126
console.error(err);

0 commit comments

Comments
 (0)