Commit e23f60f6 authored by Kelvin Fichter's avatar Kelvin Fichter

fix(cmn): BaseServiceV2 options parsing bug

Fixes a bug in BaseServiceV2 where options would not be parsed correctly
when passed directly into the constructor rather than via the
environment or command line arguments.
parent 710aba90
---
'@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
......@@ -274,17 +274,13 @@ export abstract class BaseServiceV2<
// names into lower case for the validation step. We'll turn the names back into their original
// names when we're done.
const cleaned = cleanEnv<TOptions>(
{ ...config.env, ...config.args },
{ ...config.env, ...config.args, ...(params.options || {}) },
Object.entries(params.optionsSpec || {}).reduce((acc, [key, val]) => {
acc[key.toLowerCase()] = val.validator({
desc: val.desc,
default: val.default,
})
return acc
}, {}) as any,
Object.entries(params.options || {}).reduce((acc, [key, val]) => {
acc[key.toLowerCase()] = val
return acc
}, {}) 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