To make a user-defined environment variable accessible to your edge application, you must add a key-value pair to your application's custom configuration.
In addition to simple key-value pairs, e.g. "<KEY_NAME>=<VALUE_NAME>", you can also add a file as a key's value - for example, a certificate.
Procedures
Add a key-value pair
To add an environment variable to an edge application's container instance, you must enter the variable and its value into your application's custom configuration file.
In the custom configuration file, enter your "VARIABLE_NAME" and "VARIABLE_VALUE" using the following syntax. Replace "VARIABLE_NAME" and "VARIABLE_VALUE" with the appropriate values.
<VARIABLE_NAME>=<VARIABLE_VALUE>
Add a file
- Navigate to the Configuration block, in the main page when adding an edge app instance.
- Click on Yes under Add Custom Config Template.
- Click on Add Variables Groups.
- Click on Add Variable.
- Set the variable type as File.
- Enter your Variable Name.
- In the custom Configuration Template, enter a write-file section similar the following:
The contents of the file will be written to the file provided under "path". The file can then be used in the cloud-init configuration script.write_files:
- path: /etc/mydirectory/mycertificate.cert.pem
permissions: '0644'
encoding: b64
content: ###identity_cert###