Environment variables

Loading Environment variables

By default, Upswift agent runs as a systemd service. Therefore, all system Environment variables are not reachable by the agent and can't be used with Upswift tools (Micro-updates, Remote commands, etc..).

To make the Environment variables reachable by the agent, you can load a file that contains those variables to the agent's service configuration. When the file is loaded, you will be able to use your Environment variables in all Upswift tools. Follow the next steps to load your Environment variables to Upswift agent:

  1. Create the file (if it doesn't exist) /etc/environment

  2. Set your Environment variables at the end of that file: TEST_ENV="some-value"

  3. Open the file /etc/systemd/system/upswift.service and right above the line that begins with ExecStart, enter the line: EnvironmentFile=/etc/environment

  4. Save and close the file. Then execute the command: systemctl daemon-reload

  5. Then execute the command: systemctl restart upswift

From now on, any Environment variable that will be written inside the file /etc/environment, will be accessible from Upswift tools. (If you modify that file with new Environment variables or new values, you will have to restart Upswift service)

Last updated