Skip to content

Add support for command line env variables #56

@PatrikValkovic

Description

@PatrikValkovic

This feature is similar to what cross-emv does.
Sometimes, I want to import variables both from the file and from the command line.
It would be nice if dotenv-cli would be the multiplatform tool to do that.

Proposal

Add new option to load variables from command line. For example -v:

dotenv -e ./config/.env -e ./config/.env.dev -v DB_HOST=localhost -v DB_USER=root -v DB_PASS=root -- node ./scripts/something.js

or maybe just use of single option

dotenv -e ./config/.env -e ./config/.env.dev -v DB_HOST=localhost DB_USER=root DB_PASS=root -- node ./scripts/something.js
dotenv -e ./config/.env -e ./config/.env.dev -v DB_HOST=localhost;DB_USER=root;DB_PASS=root -- node ./scripts/something.js

(Just suggestion, I would prefer most the first way)

Right now the solution would need to use both cross-env and dotenv-cli

cross-env DB_HOST=localhost DB_USER=root DB_PASS=root  dotenv -e ./config/.env -e ./config/.env.dev -- node ./scripts/something.js

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions