diff --git a/lib/config/config/__fixtures__/withForce.js b/lib/config/config/__fixtures__/withForce.js new file mode 100644 index 0000000000000000000000000000000000000000..d16cae37e4528499ac862d0c6d97efc6357ca623 --- /dev/null +++ b/lib/config/config/__fixtures__/withForce.js @@ -0,0 +1,8 @@ +// @ts-ignore +module.exports = { + token: 'abcdefg', + logLevel: 'error', + force: { + schedule: null, + } +}; diff --git a/lib/config/index.spec.ts b/lib/config/index.spec.ts index 15c5b1b6308e7760d972a20284c94339bdcbf1f3..a3dacea1d79a4459f9174be009afde2e79ff3bb3 100644 --- a/lib/config/index.spec.ts +++ b/lib/config/index.spec.ts @@ -61,6 +61,26 @@ describe('config/index', () => { ]); expect(parsedConfig).not.toContainKey('configFile'); }); + it('supports config.force', async () => { + const configPath = path.join( + __dirname, + 'config/__fixtures__/withForce.js' + ); + const env: NodeJS.ProcessEnv = { + ...defaultEnv, + RENOVATE_CONFIG_FILE: configPath, + }; + const parsedConfig = await configParser.parseConfigs(env, defaultArgv); + expect(parsedConfig).toContainEntries([ + ['token', 'abcdefg'], + [ + 'force', + { + schedule: null, + }, + ], + ]); + }); it('reads private key from file', async () => { const privateKeyPath = path.join( __dirname, diff --git a/lib/config/index.ts b/lib/config/index.ts index dc0eabe587bec091127bc44d71deb711a22dde9b..ecf675a8f070dfdfd1495fa503ae078802d9cc6c 100644 --- a/lib/config/index.ts +++ b/lib/config/index.ts @@ -65,7 +65,11 @@ export async function parseConfigs( } if (config.forceCli) { - config = mergeChildConfig(config, { force: { ...cliConfig } }); + if (config.force) { + config.force = Object.assign(config.force, { ...cliConfig }); + } else { + config.force = { ...cliConfig }; + } } if (!config.privateKey && config.privateKeyPath) {