Skip to content

Adds dotenv to load configurations #5013

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

Closed
wants to merge 1 commit into from
Closed

Adds dotenv to load configurations #5013

wants to merge 1 commit into from

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Aug 29, 2018

Adds dotenv that let us read contents of a .env file to load environment variables automatically. Will likely be used alongside #4960

@flovilmart flovilmart requested a review from acinader August 29, 2018 18:38
Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. I don't use dotenv, but I think I should re-look.

https://www.npmjs.com/package/dotenv#preload

Do you think you should just bake this into the npm scripts (npx?).

"This is the preferred approach when using import instead of require."

Also, you're trying and catch, but this is the idiom in the docs:

const result = dotenv.config()
 
if (result.error) {
  throw result.error
}
 
console.log(result.parsed)

Based on that, it seems that it won't throw? In other words, if we don't want to report on the error, we can just ignore? Presumably, you put in the catch as a result of your using it and knowing its needed, so I'm just asking.

@codecov
Copy link

codecov bot commented Aug 30, 2018

Codecov Report

Merging #5013 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5013      +/-   ##
==========================================
- Coverage   94.26%   94.24%   -0.03%     
==========================================
  Files         121      121              
  Lines        8760     8760              
==========================================
- Hits         8258     8256       -2     
- Misses        502      504       +2
Impacted Files Coverage Δ
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 91.33% <0%> (-0.75%) ⬇️
src/RestWrite.js 93.15% <0%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c0a443...3e9a7d5. Read the comment docs.

@flovilmart
Copy link
Contributor Author

I recently came across more configuration possibilities like nconf etc.. May be worth exploring.

@acinader
Copy link
Contributor

I've been using https://github.com/lorenwest/node-config for a few years.

@flovilmart
Copy link
Contributor Author

I need to jump back on this at one point!

@stale
Copy link

stale bot commented Dec 25, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 25, 2018
@stale stale bot closed this Jan 6, 2019
@mtrezza mtrezza reopened this Oct 18, 2021
@parse-github-assistant
Copy link

Thanks for opening this pull request!

  • ❌ Please edit your post and use the provided template when creating a new pull request. This helps everyone to understand your post better and asks for essential information to quicker review the pull request.

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.

3 participants