Environment Variables
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.
Nodion supports two scopes for environment variables: application-level (shared by all containers of an application) and process-level (specific to a single process). Process-level variables override application-level ones with the same key, so you can have a generic default at the application level and a different value for one process if needed.
Application-level variables
These are the default. They're available to every process of the application at runtime and, if you mark them as build-time, also during the image build. New variables can be added by navigating to your application, clicking on the Settings tab and scrolling down to the environment variables section.

Process-level variables
Sometimes a single process needs its own configuration: a worker that should run with higher concurrency, a release stage that needs an admin token, a sidecar that talks to a different upstream. Process-level variables let you configure that without polluting the rest of the application.
Open the Processes tab on your application, click the environment-variables button on the process you want to configure, and add the variable. The same key/value editor as the application level is available, plus a build-time toggle.
If a key exists at both the application and process level, the process-level value wins for that process. The application-level value still applies to every other process.
Build-time vs. runtime
By default, environment variables are only available at runtime, when your container is running. If you flip the build-time toggle (the lightning icon next to a variable), the variable is also exposed during the image build. This is what you want for things like NPM_TOKEN for installing private packages or RAILS_MASTER_KEY for asset compilation.
Build-time variables apply to the build of the entire application. If a process-level variable is marked as build-time, it joins the application-level build environment for that build.
Reserved variables
A few variables are managed by Nodion automatically and shouldn't be overridden:
PORT— set automatically for thewebprocess so your application can bind to it. See Processes for details on the$PORTconvention.NODION_GIT_SHAandNODION_GIT_SHA_SHORT— the git commit hash of the deployed code, useful for logging and version reporting.NODION_INSTANCEandNODION_HOST— identifiers of the container and host the process is running on.