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

Add json file support #188

Closed
wants to merge 2 commits into from
Closed

Add json file support #188

wants to merge 2 commits into from

Conversation

assafshp
Copy link

Allow config method to support json file path to include environment variables

@coveralls
Copy link

coveralls commented Apr 12, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 91d4b57 on assafshp:master into 825c1b2 on motdotla:master.

@maxbeatty
Copy link
Contributor

Thanks but I think we'd like to stick to our single INI file format. It's easy to emulate dotenv with a few lines of code if you would like to use JSON:

const myEnvConfig = require('.env.json')
for (const key in myEnvConfig) {
  process.env[key] = process.env[key] || myEnvConfig[key]
}

@maxbeatty maxbeatty closed this Apr 13, 2017
@trainerbill
Copy link

@maxbeatty not sure if this is still up for discussion or not, but I would like this functionality as well. I am using Yeoman and it would be nice to be able to use readJSON and change the dotenv configuration in subgenerators. I also use node -r dotenv/config when starting the application.

Your code does work but then I have to carry around an envConfig.js file in all my packages/projects. With the widespread use of dotenv it would be nice to support this. Otherwise I can just publish a module to do the exact same thing with JSON.

Let me know. Thanks!

@maxbeatty
Copy link
Contributor

I'm still in the camp of publishing lots of small, single-purpose modules as opposed to offering more and more configuration of an existing module. I published dotenv-json to get most of the way there. Feel free to contribute or fork.

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

Successfully merging this pull request may close these issues.

4 participants