Skip to content

Commit ea20ccf

Browse files
committed
fixup! feat(ncu-config): add support for partially encrypted config files
1 parent 90496c8 commit ea20ccf

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/config.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ export function clearCachedConfig() {
3535

3636
export async function encryptValue(input) {
3737
console.warn('Spawning gpg to encrypt the config value');
38-
return forceRunAsync(process.env.GPG_BIN || 'gpg', ['--default-recipient-self', '--encrypt', '--armor'], {
39-
captureStdout: true,
40-
ignoreFailure: false,
41-
spawnArgs: { input }
42-
});
38+
return forceRunAsync(
39+
process.env.GPG_BIN || 'gpg',
40+
['--default-recipient-self', '--encrypt', '--armor'],
41+
{
42+
captureStdout: true,
43+
ignoreFailure: false,
44+
spawnArgs: { input }
45+
}
46+
);
4347
}
4448

4549
function setOwnProperty(target, key, value) {

test/unit/auth.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ describe('auth', async function() {
2222
await runAuthScript(
2323
undefined,
2424
[FIRST_TIME_MSG, MOCKED_TOKEN],
25-
/^Spawning gpg to encrypt the config value\r?\nError: spawn do-not-exist ENOENT(?:.*\n)+Failed encrypt token, storing unencrypted instead\r?\n$/,
25+
/^Spawning gpg to encrypt the config value\r?\nError: spawn do-not-exist ENOENT(?:.*\n)+Failed encrypt token, storing unencrypted instead\r?\n$/
2626
);
2727
});
2828

2929
it('asks for auth data if ncurc is invalid json', async function() {
3030
await runAuthScript(
3131
{ HOME: 'this is not json' },
3232
[FIRST_TIME_MSG, MOCKED_TOKEN],
33-
/^Spawning gpg to encrypt the config value\r?\nError: spawn do-not-exist ENOENT(?:.*\n)+Failed encrypt token, storing unencrypted instead\r?\n$/,
33+
/^Spawning gpg to encrypt the config value\r?\nError: spawn do-not-exist ENOENT(?:.*\n)+Failed encrypt token, storing unencrypted instead\r?\n$/
3434
);
3535
});
3636

0 commit comments

Comments
 (0)