Skip to content

Proposal: --config=file command line argument #11997

Closed
@jasnell

Description

@jasnell

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command line interface.feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions