Giter VIP home page Giter VIP logo

Comments (5)

jfairley avatar jfairley commented on June 19, 2024

That's interesting. You raise a valid point, but I'm not sure how to easily make both work together. The problem is dotenv doesn't support "cascade" natively. There's probably no way to avoid edge cases without dotenv supporting cascade natively.

from dotenv-cli.

llovett2 avatar llovett2 commented on June 19, 2024

What if we reversed the paths array if override is set before iterating through it? I'm trying to think if that will cause any negative side effects.

from dotenv-cli.

entropitor avatar entropitor commented on June 19, 2024

Yeah, there was an earlier discussion: #63 (comment)

I think it's just incompatible. Feel free to make a PR to update the README to document this but this is not really solvable.

I think the best solution is just erroring out if using override together with multiple files, ...

from dotenv-cli.

jfairley avatar jfairley commented on June 19, 2024

Ooh man, this one bit me in the butt the other day.

Like @llovett2 found, when you run override with cascade, the order of files is effectively inverted such that values in .env will override .env.test.

We need to do something about this, because of the potential impact. In my case, a dev on my team ran unit tests that blew away our QA database.

I'm available to submit a new pull-request, but @entropitor, I'm looking to discover what you're likely to accept, considering this issue was closed before.

  1. Invert the files array when argv.c && argv.o.
    • I actually believe this is a pretty simple and readable change. I have it ready to go locally. #92
  2. Prevent "cascade with override".
    • Literally throw a runtime error if argv.c && argv.o saying it's not supported.

from dotenv-cli.

entropitor avatar entropitor commented on June 19, 2024

I think it's best to throw. I knew this was a problem when merging that's why I pushed back so hard on cascade. The other solution has a problem with expanding variables so I don't think that's valid either. I guess throwing is the most elegant solution! Happy to merge such a pr

from dotenv-cli.

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.