Commit 5ff5a00f authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #4333 from ethereum-optimism/sc/cmn-options-fix

fix(cmn): BaseServiceV2 options parsing bug
parents 134c0b89 e23f60f6
---
'@eth-optimism/common-ts': patch
---
Fixes a bug in BaseServiceV2 where options were not being parsed correctly when passed into the constructor rather than via environment variables or command line arguments
...@@ -281,17 +281,13 @@ export abstract class BaseServiceV2< ...@@ -281,17 +281,13 @@ export abstract class BaseServiceV2<
// names into lower case for the validation step. We'll turn the names back into their original // names into lower case for the validation step. We'll turn the names back into their original
// names when we're done. // names when we're done.
const cleaned = cleanEnv<TOptions>( const cleaned = cleanEnv<TOptions>(
{ ...config.env, ...config.args }, { ...config.env, ...config.args, ...(params.options || {}) },
Object.entries(params.optionsSpec || {}).reduce((acc, [key, val]) => { Object.entries(params.optionsSpec || {}).reduce((acc, [key, val]) => {
acc[key.toLowerCase()] = val.validator({ acc[key.toLowerCase()] = val.validator({
desc: val.desc, desc: val.desc,
default: val.default, default: val.default,
}) })
return acc return acc
}, {}) as any,
Object.entries(params.options || {}).reduce((acc, [key, val]) => {
acc[key.toLowerCase()] = val
return acc
}, {}) as any }, {}) as any
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment