Why environment variables are useful and how to add them to your application.
Environment variables are great if you want to seperate multiple environments and store information securely. For example if you have a staging and a production environment and each environment has a different database, it makes sense to store the database credentials as environment variables and access them from your source code. This way you don't have hard-coded credentials and the source code stays the same.
Environment variables are injected at build time. If you make changes to your environment variable, the next time you deploy something they will be part of the image and accessible by your application.
Adding Environment Variables
New environment variables can be added by navigating to your application, clicking on the
Settings tab and scrolling down a bit to the environment variables section.
Within your application you are able to add services, for example a database. When creation of this database is finished, environment variables are automatically added to the application.