We have recently started removing credentials in env vars and started using google secret manager (previously berglas) and its been amazing so far. AWS and azure should have the same. More challenging when you don’t have all the infrastructure and services in place (ie. when working on plain VPS or other systems without those tools)
Don't use ENV variables for secret data (2017)
21–30 of 147 posts
Re: Don't use ENV variables for secret data (2017)
#22Every production product I’ve ever worked on, the entire team put database credentials in the environment variables.
Re: Don't use ENV variables for secret data (2017)
#23The way I got around this was to store secrets in Google KMS encrypted files in Google Cloud Storage. The KMS key and encrypted files share the same name and can be accessed by that name programmatically. This secret storage method works really well for me and lets you easily access & manage secrets across all environments. It's so convenient, I sometimes even use this system as a simple key/value store.
Re: Don't use ENV variables for secret data (2017)
#24Every production product I’ve ever worked on, the entire team put database credentials in the environment variables.
Re: Don't use ENV variables for secret data (2017)
#25The advice is good. But why is ENV capitalized? The term is just "environment variable". One heuristic I use for evaluating technical material is orthography: if you spell or capitalize or spell something improperly, it's likely you'll get a lot else wrong too. As for secret storage: didn't we solve this problem with keyrings? If I must put a secret in long-term plaintext storage, I might as well put it in a file, wh…
https://www.php.net/manual/en/reserved.variables.environment...
Re: Don't use ENV variables for secret data (2017)
#26Earlier quoted context omitted.
It's way better than hard coding them into the code.
Why is that? Also, as an aside: The very premise of plaintext credentials for computer-computer database connections always seemed strange to me. Maybe I'm just not knowledgeable enough here, but I wish the standard for database credentials was key-based.
If you don't store secrets in your codebase, they're just on ~one machine: the server hosting your application.
Re: Don't use ENV variables for secret data (2017)
#27Re: Don't use ENV variables for secret data (2017)
#28Re: Don't use ENV variables for secret data (2017)
#29The advice is good. But why is ENV capitalized? The term is just "environment variable". One heuristic I use for evaluating technical material is orthography: if you spell or capitalize or spell something improperly, it's likely you'll get a lot else wrong too. As for secret storage: didn't we solve this problem with keyrings? If I must put a secret in long-term plaintext storage, I might as well put it in a file, wh…
Re: Don't use ENV variables for secret data (2017)
#30This way you can move secret data to files if needed depending on the deployment choice.
My own rule of thumb is:
1) sensible default value
2) read from file
3) read from env
Examples:
- https://github.com/spf13/viper
- https://docs.spring.io/spring-boot/docs/current/reference/ht...