I don't get it. Dotenv is only good for local dev. Otherwise you should put your secrets in environment variables (the "env" in ".env"). That people put .env files in prod is a mistake itself, and the proposed fixes here seem to not really do much about that.
Just set those env vars in your IDE. Let your IDE or docker-compose or whatever read an .env file if you must. But don't do it directly from your application code, indeed you're one lazy dev away from putting an .env file on prod servers. Using dotenv-like constructions is, in my eyes, an antipattern.
Show HN: From dotenv to dotenvx – better config management
101–110 of 223 posts
Re: Show HN: From dotenv to dotenvx – better config management
#102I _detest_ this kind of encryption. It's literally worse than useless. It makes life much harder during debugging, and it eventually leads to developers just storing the decryption keys locally. For this kind of encryption to work, you need to supply the decryption key from some outside system (e.g. via env vars, AWS SSM, etc.). And if it can supply the key, then why not just use it for other important secrets direct…
Re: Show HN: From dotenv to dotenvx – better config management
#103Does dotenvx support secrets managers?
Re: Show HN: From dotenv to dotenvx – better config management
#104Seems pretty similar to sops[0], but without the encrypted-by-default feature that makes sops feel significantly safer for secret management. Sops also integrates easily with AWS and other existing key management solutions, so that you can use your existing IAM controls on keys. I mentioned in another comment, but I've been using it over five years at two jobs and have found it to be great. [0]: https://github.com/ge…
I'd prefer an integration between dotevnx and sops where dotevnx handles the UX of public env and injection, while leveraging sops for secret management and retrieval. Additionally, being able to have multiple keys for different actors is important.
Having a single `.env.keys` file feels risky and error prone. dotenvx encourages adding your various env files, such as `.env.production`, to vcs, and you're one simple mistake away from committing your keyfile and having a bad day.
If sops is not to be integrated, dotenvx could take some inspiration where the main key is encrypted in the secrets file itself, and you can define multiple age key recipients, each of which can then decrypt the main key.
Re: Show HN: From dotenv to dotenvx – better config management
#105I do like to keep a .env.example that you can rename to .env and adjust as desired. I tend to have defaults for running a compose stack locally that close to "just works" as possible.
I doubt I'd ever want to use this in practice.
Re: Show HN: From dotenv to dotenvx – better config management
#106I always used foreman [0] which I found to be superior to dotenv in every way. Even superior to this new dotenvx [0] https://github.com/ddollar/foreman
Re: Show HN: From dotenv to dotenvx – better config management
#107Re: Show HN: From dotenv to dotenvx – better config management
#108I wonder if dotenvx ensures that .env is in .gitignore and yells loudly if it is not.
I encrypt my dotenvs with gpg, but that's hella esoteric and everyone shouldn't be forced to do that.
Re: Show HN: From dotenv to dotenvx – better config management
#109On my phone so can’t double test, but can’t you get this by adding “export” in front of every line in your env file and then source before running command? I suppose if you don’t want it to stay after execution i believe you can: > $(source .env; my command) I’m sure there is a fairly straightforward way to encrypt and decrypt a local file
#!/bin/bash
set -o allexport
. .env
set +o allexport
cmdRe: Show HN: From dotenv to dotenvx – better config management
#110I want an option to manage all env in a single file using a TOML like format like this. [local] API_KEY=local-key API_SECRET=local-secret DB=postgresql://username:password@localhost:5432/database_name [production] API_KEY=prod-key API_SECRET=prod-secret DB=postgresql://username:password@prod-db:5432/database_name [staging] API_KEY=stg-key API_SECRET=stg-secret DB=$(production.DB) It makes it easier to update all env…