Comments (9)
That should be the other way around, with dotenv overriding everything unless the user wants to preserve magic environment variables. The expectation is that .env files override any and all preexisting variables.
from dotenv.
That looks like it's related to decryption? I didn't see dotenv warn me about this at all when I had a normal USERNAME=...
in a plain .env
file, and having it yell at me about that with an instruction on how to make it either stop warning or force the override would have prevented me from filing an issue =)
dotenvx looks interesting, but you may want to change the quickstart to show how to install it for everyone rather than just Mac users (the actual cross-platform instruction is way down the additional ways page). And showing that it can be used in code in the readme would be quite valuable too. My initial reaction was "oh it's a cli tool? Guess that's a no go then". It wasn't until I scrolled down the ways-to-install page all the way down to NPM use that it was clear it would still work as replacement for dotenv in code.
from dotenv.
how's this, better?
(adjusting the /docs site to have this order as well)
from dotenv.
"USERNAME" is already defined and was NOT overwritten
when enabling the debug logs for me. Downstream issue from the Playwright project: microsoft/playwright#29030
from dotenv.
use override
force it.
require('dotenv').config({ override: true })
https://github.com/motdotla/dotenv#override
from dotenv.
I can understand the feeling. We went back and forth on that (many times) but for years now dotenv does NOT override if already set on your machine. Unless you pass the override option.
from dotenv.
In that case can I at least request a new default behaviour feature where dotenv will log an stdout warning about the fact that the way it just got told to load in has an .env vs OS conflict, and to add override:true
is that magic is not wanted? (not necessarily listing the var names that conflict, that's a bonus, but just getting that signal at all would be super useful)
from dotenv.
@Pomax it does that here: https://github.com/motdotla/dotenv/blob/master/lib/main.js#L287
If you are looking for even more detailed logging, check out dotenvx
. It doesn't have the same constraint as dotenv (no dependencies) and as a result it is able to do much more detailed logging, among many other things. I personally am moving a lot of my .env and .env.vault usage to it.
from dotenv.
Ooh, that's pretty great! Though it would be good to mention the global install for all three OSses (linux, mac, and windows) rather than only giving the MacOS option.
from dotenv.
Related Issues (20)
- Example usage links not working HOT 2
- only the page with require("dotenv").config is seeing values HOT 2
- NodeJS 18 native feature caveats and `dotenvx` HOT 7
- Archive repo HOT 3
- Bug: `_parseVault()` doesnโt respect `processEnv` option. HOT 3
- Can we throw or stop execution through .env? HOT 3
- Readme links to nonexisting example page HOT 2
- override system variables HOT 2
- Cannot find module 'node:url' or its corresponding type declarations HOT 4
- In ES6 DOTENV enviroment not getting HOT 2
- Use of dotenv in a cron job with ES6 modules HOT 2
- Another issue asking about multiple env files HOT 6
- Links in examples section on NPM package page are broken HOT 1
- DotenvPopulateOutput typing is incorrect HOT 1
- Request for help! HOT 3
- Using an array for config.path does not work HOT 1
- Crypto HOT 1
- Troubleshooting dotenv Preloading in GitHub Actions HOT 3
- Multiple paths in config: README incorrect? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotenv.