Strict mode check for custom environment variables

Author: davesteinbergCreated Dec 5, 2017Updated Mar 12, 2026
Labelspr-welcome

I'm submitting a ...

  • [ ] bug report
  • feature request
  • [ ] support request or question => Please do not submit support request or questions here, see note at the top of this template.

When using a custom-environment-variables.json file to read config values from environment variables it would be very handy to have automatic validation that those environment variables have been set.

Currently, if an environment variable is not set, you get undefined from config, so you need to manually check for that in the code accesses it. A useful error message needs to refer to the environment variable name, which you don't have access to in that code (since it's defined in the json file).

It would be great if config would print a warning or throw an error (in strict mode) when a property declared in custom-environment-variables is undefined because it is not redeclared in another config file and the custom environment variable is not set.

(That is, the environment variable need not be set if another config file declares a specific value for the property. For example, I'd imagine that people might use use local.json in place of one or more environment variables at dev-time.)