The environment should be used to configure your application. When your project is deployed and a new container is started, all the variables defined in your environment are automatically injected into it.
To set an environment variable, there are two ways to do it:
- In the "Environment" category in your dashboard
- Using our CLI and the commands
You can define aliases of environment variables:
In this case the
DATABASE_URL becomes an alias of
Using the environment to configure your application is one of twelve good practices defined in the 12 factors.
You should avoid writing any credentials in the files managed by
Accessing the environment from your app
The following example is to get the value of the
The process shoul not be really different, refer to the documentation of the standard library of your language.