Code Monkey home page Code Monkey logo

Comments (5)

kt3k avatar kt3k commented on June 17, 2024

IMO, --env is undoubtedly superior to load() for a few reasons.

Can you elaborate on this? --env is still unstable feature, and I don't see much adoption of it. It's still possible that --env could be changed drastically or removed in the future.

Emulate the behavior of --env.

Can you elaborate on this? What's the main differences?

Simplify its behavior to load a .env file given by a path, and remove all options.

Why remove all options? I saw some complaints about handling of .env.example and .env.default (#3516), but didn't see problems with others.

Return true when the given .env is loaded and false if not found.

Sounds like unnecessary breaking change to me.

from deno_std.

iuioiua avatar iuioiua commented on June 17, 2024

Can you elaborate on this? --env is still unstable feature, and I don't see much adoption of it. It's still possible that --env could be changed drastically or removed in the future.

Some aspects of load() have surprising behavior. E.g. see #3561. I feel like I've elaborated on load()'s design a sufficient amount here and in the issues/PRs linked above. The amount of adoption of --env is less obvious than load() as it doesn't live in code. --env can live in deno.json tasks, but even that only shows a part of the use of --env.

Can you elaborate on this? What's the main differences?

Mostly, not throwing when a .env is not found. Though, I'm unsure that doing so is the right way to go.

Why remove all options? I saw some complaints about handling of .env.example and .env.default (#3516), but didn't see problems with others.

It doesn't have to go that far. Perhaps removing .env.example and .env.default functionality is sufficient.

Sounds like unnecessary breaking change to me.

It provides feedback on whether a .env file is detected and used. AFAIK, load() currently provides no such feedback.

from deno_std.

Leokuma avatar Leokuma commented on June 17, 2024

I agree with items 1 and 4.


  1. Simplify its behavior to load a .env file given by a path, and remove all options.

If we can't reach consensus about this, we could instead keep all options, just remove their defaults ".env.example" and ".env.defaults" so that it's mandatory to specify the filenames if you want to load them.

  1. Return true when the given .env is loaded and false if not found.

Currently it returns the parsed object, which is useful. If we make that change, it will be necessary to call load() and parse() in order to know what was parsed.

One of the reasons why --env adoption could be low is that it's still pretty new, while Dotenv has years of history and many apps were already using Dotenv.

from deno_std.

iuioiua avatar iuioiua commented on June 17, 2024

Ok. I've amended by suggestion. PTAL @Leokuma and @kt3k.

from deno_std.

kt3k avatar kt3k commented on June 17, 2024

2. sounds good to me.

I still don't get 1. and 3. well.

Can you elaborate on this? What's the main differences?

Mostly, not throwing when a .env is not found. Though, I'm unsure that doing so is the right way to go.

To my understanding --env and load() both don't throw when the .env file not found (but the former warns if it doesn't find it).

Throw only when the given .env file exists but is invalid.

In what cases load stops throwing with this suggestion?

from deno_std.

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.