Description
In a number of conversations (e.g. #11888), the idea of introducing either a NODEOPT
environment variable that would allow arbitrary command line flags to be set via the environment, or a .noderc
configuration file that could provide configuration options has been discussed. These choices have their merits and their disadvantages. One of the key disadvantages for me is the potential for the configuration collisions across applications and spooky action coming from environment settings that are unknown to the user. I much prefer explicit opt-in solutions.
One approach that could work that can potentially fill the gap is allowing configuration settings to be set using a .noderc
type configuration file that is explicitly passed in via command line argument:
$ node --config=/some/path/.noderc app.js
If a user wanted to make use of environment variables in various environments, they could easily do so via variable expansion:
$ export NODEOPT=/some/path/.noderc_production
$ node --config=${NODEOPT}