Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support boolean values in resolveOptions func #174

Open
bartmacbartek opened this issue Apr 28, 2021 · 3 comments
Open

Support boolean values in resolveOptions func #174

bartmacbartek opened this issue Apr 28, 2021 · 3 comments
Labels
Binary Code for the actual executable enhancement New feature or request
Projects

Comments

@bartmacbartek
Copy link
Contributor

bartmacbartek commented Apr 28, 2021

Reference: https://github.com/confio/ts-relayer/pull/173/files/af3e18ccdaeb5e9f817c1d0372c0ffba6d12993c#r622158971

Allow for boolean values in resolveOption function: https://github.com/confio/ts-relayer/blob/main/src/binary/utils/options/resolve-option.ts

e.g.

const enableMetrics = resolveOption('enableMetrics', { required: true, boolean: true })(
  flags.enableMetrics,
  process.env.RELAYER_ENABLE_METRICS,
  app?.enableMetrics,
  false,
)

Currently, it's only capable of resolving strings to string/integer.

@bartmacbartek bartmacbartek added enhancement New feature or request Binary Code for the actual executable labels Apr 28, 2021
@bartmacbartek
Copy link
Contributor Author

bartmacbartek commented Apr 28, 2021

I wonder if this is not an overkill. If boolean flag is not passed, it gets a false value and we never need to throw. 🤷

@ethanfrey
Copy link
Member

I wonder if this is not an overkill. If boolean flags is not passed, it gets a false value and we never need to throw. shrug

I guess you are right. Maybe just the non-required version?

@bartmacbartek
Copy link
Contributor Author

I guess you are right. Maybe just the non-required version?

Yeah, I'll try to come up with something nice. Let's see...

@ethanfrey ethanfrey added this to To do in Relayer Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Binary Code for the actual executable enhancement New feature or request
Projects
No open projects
Relayer
To do
Development

No branches or pull requests

2 participants