electrode-io / electrode-confippet

node.js environment aware application configuration
Other
108 stars 18 forks source link

fail vs warn #14

Open wmertens opened 7 years ago

wmertens commented 7 years ago

Currently, you can only throw on failure, but you can't get a warning instead. failMissing and warnMissing work on different provider types.

Is this intentional? I would like to remind my users to create a config file for the current environment, not crash the app…

jchip commented 7 years ago

every provider supports the same set of functionalities. You can set a provider type to required, disabled, optional, or warn.

see doc here: https://github.com/electrode-io/electrode-confippet/blob/master/compose.md#confippetcomposeconfig

If you want a warning if the file for a provider is missing, you can set its type to warn.

wmertens commented 7 years ago

As a user, it's surprising to me that providers have only a single behavior like this. It requires you to know exactly what the providers are named and how their data structure is if you want to change their type…