Code Monkey home page Code Monkey logo

Comments (9)

Pomax avatar Pomax commented on June 12, 2024 1

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.

Pomax avatar Pomax commented on June 12, 2024 1

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.

motdotla avatar motdotla commented on June 12, 2024 1

how's this, better?

image

(adjusting the /docs site to have this order as well)

from dotenv.

mxschmitt avatar mxschmitt commented on June 12, 2024

"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.

motdotla avatar motdotla commented on June 12, 2024

use override force it.

require('dotenv').config({ override: true })

https://github.com/motdotla/dotenv#override

from dotenv.

motdotla avatar motdotla commented on June 12, 2024

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.

Pomax avatar Pomax commented on June 12, 2024

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.

motdotla avatar motdotla commented on June 12, 2024

@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.

Pomax avatar Pomax commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.