diff --git a/lib/compose/cli.cjs b/lib/compose/cli.cjs index 2d1e2517..44fcf092 100755 --- a/lib/compose/cli.cjs +++ b/lib/compose/cli.cjs @@ -12,10 +12,11 @@ async function main() { // Check if --ignoreIdConfig flag is provided const ignoreIdConfig = argv.ignoreIdConfig || false + const force = argv.force || false await runInParallel( require.resolve('./worker.cjs'), - communes.map(codeCommune => ({codeCommune, ignoreIdConfig})), + communes.map(codeCommune => ({codeCommune, force, ignoreIdConfig})), {maxWorkerMemory: 3072, maxRetries: 5} ) diff --git a/lib/compose/worker.cjs b/lib/compose/worker.cjs index 99e74310..d8fe1731 100644 --- a/lib/compose/worker.cjs +++ b/lib/compose/worker.cjs @@ -4,10 +4,17 @@ const composeCommune = require('./index.cjs') async function main(options) { await mongo.connect() - const {codeCommune, ignoreIdConfig} = options + const {codeCommune, force, ignoreIdConfig} = options console.time(`commune ${codeCommune}`) + if (force) { + await mongo.db.collection('communes').updateOne( + {codeCommune}, + {$set: {compositionOptions: {force: true}}} + ) + } + await composeCommune(codeCommune, ignoreIdConfig) await finishComposition(codeCommune)