Introduction
Environment variables let you pass configuration values to your application at runtime without modifying the container image. In Edge Infrastructure Services, environment variables for application instances are delivered through the custom configuration mechanism using the cloud-init standard. This procedure covers two approaches:- Key-value pairs: pass simple
VARIABLE_NAME=VALUEpairs to the application as environment variables. - File injection: write a file (for example, a certificate or configuration file) to the container filesystem before startup.
Prerequisites
- You have the SysManager or SysAdmin role in your enterprise. See Manage Roles.
- You are working with a Container or VM app type. Docker Compose environment variables are handled through the compose file.
How Environment Variables Are Delivered
EVE-OS (Edge Virtualization Engine) delivers cloud-init configuration to application instances when they start. For container instances, EVE-OS parses the custom configuration and applies it directly (no cloud-init daemon required in the container):- Simple key-value format: use
VARIABLE_NAME=VALUEpairs, one per line. This is the legacy format supported across all EVE-OS LTS versions. - Cloud-init format: use the standard cloud-init
runcmdfield to set environment variables, and optionallywrite_filesto inject files. Available since EVE-OS 11.3.
Set Up Environment Variables in the App Image
Environment variables passed via custom configuration are defined as part of the edge app image. Add the custom configuration template and variable groups to the app image before deploying any instances.- Navigate to Infrastructure > Workloads > Build > App Images.
- Open the app image or click Add Image to create a new one.
- In the Custom Configuration section, enable custom configuration.
- Add a variable group to hold your environment variable definitions.
- For each environment variable you want to expose:
- Add a variable of type Text or Password (for sensitive values).
- Set the Name to the variable identifier used in the template (for example,
API_KEY). - Set the Label to a user-friendly name (for example, “API Key”).
- Mark it as Required if a value must always be provided.
- In the Configuration Template, enter the cloud-init content that sets the environment variables. Use the field delimiter to reference each variable. For example, if the delimiter is
###:
#cloud-config:
- Save the app image.
Inject a File into a Container
To write a file (for example, a certificate) to the container filesystem, use thewrite_files cloud-init directive in the configuration template.
- In the app image’s custom configuration, add a variable of type File named
CERT_CONTENT(or a name appropriate for your use case). - In the Configuration Template, reference the variable in a
write_filesblock:
/etc/myapp/server.cert.pem before starting the container.
Supply Variable Values at Deploy Time
When you deploy an instance from the app image, the Custom Config step in the wizard prompts for the values of each variable you defined.- Navigate to Infrastructure > Workloads > Applications.
- Select the contextual + create action and select the app image.
- Complete the App & Target and Interfaces steps.
- In the Custom Config step, enter values for each environment variable.
- Complete the wizard and click Create Application.
Update Environment Variables
After an instance is deployed, changing environment variable values requires a restart or reactivation to take effect:- If the app image allows configuration override, click the Configure (gear) icon on the instance detail page to update the values.
- Changes to the variable groups themselves (adding, removing, or renaming variables) require deleting and redeploying the instance with the updated configuration.
Use a System Variable
Edge Infrastructure Services provides built-in system variables that are automatically replaced with platform values at deploy time. For example, you can include the node name in the configuration without knowing it at authoring time. Refer to the custom configuration settings in the app image for the list of available system variables and their syntax.Next Steps
Custom Configuration for Applications
The full custom configuration reference, including all variable types and template syntax.
Deploy an Application Instance
The full deployment wizard walkthrough.
Add an Edge App Image
Create a new app image with environment variable support.