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

Getting an undefined config should throw an error #10

Open
mdeltito opened this issue Apr 21, 2022 · 0 comments
Open

Getting an undefined config should throw an error #10

mdeltito opened this issue Apr 21, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mdeltito
Copy link
Member

Consider the following:

const Config = require('@logdna/env-config')

const config = new Config([
  Config.string('loglevel').default('info')
, Config.number('port').default(3000)
])

const foo = config.get('something-else') // happily returns undefined
// do something important with foo...

Rather than just silently failing in this case (e.g. a typo in the config name, or you just forgot to add it...) we should throw an error.

While there may be valid use cases for "dynamic" configuration in which the properties are expected to be (potentially) unknown, the default behavior should be more strict.

@mdeltito mdeltito added the enhancement New feature or request label Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant