In the software engineering industry, we see more and more tools using environment variables as their main configuration mechanism. 12factor, Docker containers, PaaS such as Heroku, … environment variables are everywhere. Recently, Symfony also changed to use environment variables, via a
.env file, by default.
These .env files are hard to manage
.env files (or environment variables in general) is not straightforward. Multiple times, I’ve faced these situations:
- I’m a new user, what should I put in each values? Which variables should I even have?
- The application changed, which new environment variable do I need to add?
- A given variable depends on another one. So I couldn’t put anything in
Bbecause I’ve set
falsein the previous variable
I believe these situations can and should be massively improved, and that’s why I’ve build Companienv.
Companienv will generate the .env file
Companienv is an open-source command line tool that helps to generate
.env files from a “distribution” version: a
.env.dist file. This “distribution file”,
.env.dist, should be in your code repository and will contain the documentation of the every variable.
You will find more in the GitHub repository but in a nutshell, Companienv will helps you to:
- Read and populate default values
- Identify and request only missing variables
- Propagate files (copy files from somewhere else)
- Generate public/private RSA keys
- Generate SSL certificates
- Much more, via your own extensions