Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load .env files #12

Open
ericclemmons opened this issue May 6, 2018 · 4 comments
Open

Load .env files #12

ericclemmons opened this issue May 6, 2018 · 4 comments

Comments

@ericclemmons
Copy link
Owner

It'd be cool if this support .env files or node-config by default.

@blakerutledge
Copy link

I needed this functionality a bit ago, but didnt have time to do anything worth a PR, i.e., I changed the default behavior of this module in a non-optional way and added a dependency.. so my fork loads from the .env file that is siblings with, or in a parent folder of the package.json file. Figured id leave this here in case it helps anyone: https://github.com/blakerutledge/per-env

@ericclemmons
Copy link
Owner Author

ericclemmons commented Oct 30, 2018 via email

@blakerutledge
Copy link

Ah thanks mate! Just ran into a lil blocker this morning, so added a feature that helps me out -- you can now specify an .env key besides the default NODE_ENV, just by passing a parameter in npm script:

{
    "main": "per-env CUSTOM_KEY",
    "main:custom1": "node custom1.js",
    "main:custom2": "node custom2.js"
}

in .env:

  NODE_ENV=dev
  SUB_APP=subapp1

@chuahcheeshian
Copy link

@ericclemmons

NODE_ENV in .env file is supported by by-node-env since v1.2.0.

Please have a look if it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants