Prompt
What should I use instead of storing secrets in env files?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Instead of storing secrets in .env files, use a real secrets manager or your platform’s built-in secret storage.
Good options
- Cloud secret managers
- AWS Secrets Manager / SSM Parameter Store
- Google Secret Manager
- Azure Key Vault
- Vault systems
- HashiCorp Vault
- Platform secret storage
- Kubernetes Secrets
- Docker secrets
- GitHub Actions / GitLab CI / CircleCI secrets for CI/CD
- Local development
- OS keychain tools
direnv+ a secrets manager- encrypted files with tools like
sopsorgit-crypt
Best practice
- Keep non-sensitive config in normal config files or environment variables.
- Store actual secrets in a secret manager.
- Inject secrets at runtime, not committed to code or repo.
If you still want a simple workflow
A common pattern is:
- Store secrets in a secrets manager
- Load them into the app on startup
- Cache them briefly in memory if needed
- Rotate them regularly
Avoid
- Committing
.envfiles to git - Sharing secrets in chat/email
- Baking secrets into Docker images or binaries
If you want, I can recommend the best option based on your stack, like AWS, Kubernetes, Docker, or local-only development.