How to add environment variables to edge applications

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

  1. Log in to the ZEDEDA GUI.
  2. Hover over Marketplace on the left panel.
  3. Select Edge Apps from the options.
  4. Click on the + icon to create a new edge app.
  5. Select the Edge App Type (Container, Docker Compose, or VM).
  6. After setting up the interfaces, proceed to the Configurations tab.
  7. Click the Add Custom Config Template checkbox.
  8. Click on Add Variables Groups.
  9. Click on Add Variable.
  10. Set the variable type as File.
  11. Enter your Variable Name.
  12. In the custom Configuration Template, enter a write-file section similar the following:
    write_files: 
    - path: /etc/mydirectory/mycertificate.cert.pem
      permissions: '0644'
      encoding: b64
      content: ###identity_cert###
    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.
Was this article helpful?
1 out of 1 found this helpful