Closed BluestockLabs closed 1 month ago
Sorry, I was logged in to a client's account. @drvnprgrmr is the actual author of this issue.
Yeah. Mistake on my part.
can you please share the exact steps (or a repository) that reproduces this potential limitation of @nestjs/config
? I want to make sure that this is not a misconfiguration on the consumer side. I just tested the npx dotenv-vault@latest pull
feature, which is working fine because it just downloads the .env
that will be read by @nestjs/config
later
@micalevisk yes all those work. The issue is that @nestjs/config doesn't automatically decrypt the dotenv vault based on the environment variable: DOTENV_KEY
.
I believe that's the whole point of the vault. That way you don't have to always update your environment variables on whatever server you're using. Just commit the vault and push and your environment is reflected.
The issue is that @nestjs/config doesn't automatically decrypt the dotenv vault based on the environment variable: DOTENV_KEY.
Does dotenv
alone automatically decrypt the dotenv vault?
yes, like this: https://github.com/dotenv-org/examples/blob/master/usage/dotenv-vault-custom-target/index.js
note that you can have an env. var called DOTENV_KEY
instead of supplying it to dotenv.config()
not sure how we could support it on @nestjs/config
tho. I guess configService.get("HELLO")
should return "Universe"
, in that example. And this is not working.
@kamilmysliwiec Yes it does.
It sounds like dotenv-vault is going to be deprecated in favor of dotenvx anyway
https://github.com/dotenvx/dotenvx?tab=readme-ov-file#what-happened-to-the-envvault-file
It sounds like dotenv-vault is going to be deprecated in favor of dotenvx anyway
https://github.com/dotenvx/dotenvx?tab=readme-ov-file#what-happened-to-the-envvault-file
Okay thanks for that. I didn't know.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I recently made the switch from using just dotenv to using dotenv-vault. Most things stay the same except it allows you to sync dotenv files securely and provides central management for it.
I was just about to deploy an app when I noticed it wasn't reading the env files after I had provided the DOTENV_KEY. I did a little digging around and it doesn't seem like this
config
module from nest supports that.Describe the solution you'd like
I'd like support for loading environment variables from encrypted
.env.vault
files after providing the DOTENV_KEY.Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
Though dotenv-vault is relatively new compared to dotenv, I believe adoption is growing and sooner or later Nestjs users will request for support for this feature (I'm actually a bit surprised that no one as asked about this yet)