-
Notifications
You must be signed in to change notification settings - Fork 507
A side effect-free loadConfigs for build time testing and esoteric uses. #801
Description
In #796 I mentioned wanting some of the utils factored out for code cleanliness and standalone use.
In particular I cited a solution I implemented that made a peculiar use of util.loadConfigs() that I used to support a more robust module defaults.
But there’s another more obvious use and that’s providing validation of the entire config directory. Without forced reloading of node-config which IMO is gross.
I am proposing a version of loadConfigs that uses no ENV variables and does not modify the internal state like the sources, instead it returns a map that contains all of these modifications, and Config.util.loadConfigs() can call it and then apply the state changes to itself.
The idea here would be to provide a CLI for node-config that provides a list of NODE_CONFIG_ENV values and can check all files for well-formedness.
This might be a starting point for evacuating the other incidental util functions that don’t actually utilize the Config object or don’t really need to.