deno-dotenv icon indicating copy to clipboard operation
deno-dotenv copied to clipboard

doesn't parse .env.local

Open ralyodio opened this issue 2 years ago • 11 comments

import "https://deno.land/x/dotenv/load.ts"

this doesn't parse .env.local

ralyodio avatar Oct 28 '21 07:10 ralyodio

Is that really an issue? I mean, people can have many different names for their env files: .env.test, .env.ci and .env.local and various different combinations — it is not really possible to predict them, and perhaps not worth trying (I even think that this feature of automatic loading of the environment is unnecessary, as it disables you from doing the import in a controlled and configured way — but that perhaps is a different question)

pasha-bolokhov avatar Jan 12 '22 03:01 pasha-bolokhov

@pasha-bolokhov I think that is a new convention building up in Node.js community, promoted by Vite. It would be great it this can be provided.

Idea: https://vitejs.dev/guide/env-and-mode.html#env-files

I think the original dotenv has implemented this as well

winston0410 avatar Aug 29 '22 21:08 winston0410

Would be interesting to see how Node implemented it. I mean it's all straightforward except where do you get the current mode from?

pasha-bolokhov avatar Aug 29 '22 22:08 pasha-bolokhov

Usually they get that from NODE_ENV. Is this env used at all in Deno? I don't think it is necessary in Deno's context?

winston0410 avatar Aug 30 '22 15:08 winston0410

I've never seen it being used. But it's not that we can't use it. We can use NODE_ENV just for the sake of getting the current running mode. Can also (in addition) use DENO_ENV with a higher priority. How does that sound?

pasha-bolokhov avatar Aug 30 '22 16:08 pasha-bolokhov

I've never seen it being used. But it's not that we can't use it. We can use NODE_ENV just for the sake of getting the current running mode. Can also (in addition) use DENO_ENV with a higher priority. How does that sound?

That sounds good to me!

winston0410 avatar Aug 30 '22 17:08 winston0410

Just to mention, I did not notice it having been implemented in Node. If anyone has, lemme know, it would be good to follow the same pattern. If they haven't, then we have a chance to be faster than them…

pasha-bolokhov avatar Aug 30 '22 17:08 pasha-bolokhov

I think that is implemented in dotenv of NPM already? But I am not sure where in their source.

winston0410 avatar Aug 30 '22 18:08 winston0410

It never mentions it in the docs, never found it

pasha-bolokhov avatar Aug 30 '22 19:08 pasha-bolokhov

This is what they have on their docs page: https://github.com/motdotla/dotenv#should-i-have-multiple-env-files

pasha-bolokhov avatar Aug 30 '22 19:08 pasha-bolokhov

So we need to make some consensus on whether or not or how to proceed…

pasha-bolokhov avatar Aug 30 '22 19:08 pasha-bolokhov