Skip to content

Getting an undefined config should throw an error #10

@mdeltito

Description

@mdeltito

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions