Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

overwrite env files with envvar #60

Open
jchannon opened this issue Jan 6, 2022 · 1 comment
Open

overwrite env files with envvar #60

jchannon opened this issue Jan 6, 2022 · 1 comment

Comments

@jchannon
Copy link

jchannon commented Jan 6, 2022

If you have an .env file with a value set but then set an env var whilst running deno it is not overwritten.

in deployment cases often, envvars will be set as part of deployment for prod secrets that you may not want in files in source control

TwitterApiKey=233

TwitterApiKey=456 deno run --allow-read --allow-env mod.ts

console.log(dotenvConfig.TwitterApiKey) = 233 but I would expect it to be 456

@pasha-bolokhov
Copy link
Contributor

System env import works one way currently — that is, dotenv exports (if it was configured to) the config as environment variables, but ignores what already exists in the environment. Usually this is enough, because you can override your environment by just substituting a different .env file in a production setting.

However, you may be right, that it could be convenient to be able to override the .env settings by just explicitly setting an environment variable

If this is a desired feature, I could implement it easily. My worry is that my PRs are not getting reviewed by anyone. The current code really needs a good deal of refactor, which I would strongly recommend doing, before implementing other features. Yet, I can't get ahold of the author of this package

If I fail in that, I might as well develop my own fork of this repository…

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants