Environment Variables
Applications running on Lens AppIQ have the capability of using environment variables to handle configurations. For example, if users need to connect with a third-party service like the Twitter API, the application will potentially need things like an api_key.
Using Lens AppIQ, the recommended way to expose these values to applications is by using environment variables. To make this easy, Lens AppIQ provides options to set and get environment variables in a running application through the dashboard and CLI, as described below.
Set Environment Variables
DASHBOARD
You can set application environment variables using our dashboard by clicking on the Applications link on the side menu, which will take you to the application management screen.
Click on the specific application you are interested in, and then select Configure -> Variables
Click on ENV Variables will give you the following options:
Click on the Add button, which will prompt you the options below:
When setting environment variables, there following options are presented:
- Variable(s) Type: Public where the variables are stored and exposed in plain text, or Private where the variables are stored and exposed in an encrypted format
- Requires restart: If you want Lens AppIQ to restart the app when variables are set automatically
CLI
To set environment variables for an application, use the env set command.
lapps env set <NAME=value> [NAME=value] [-a/--app appname] [-p/--private] [--no-restart]
Flags:
Flag | Description |
---|---|
-a, --app | (= "") application name |
--no-restart | (= false) sets environment variables without restarting the application |
-p, --private | (= false) private environment variables |
Display Environment Variables
DASHBOARD
You can see all environment variables assigned to an application in the dashboard by visiting the application details page
Click on the desired application. You can find current environment variables through the ENV VARIABLES tab as shown below:
Or you can click on the ENV Variables button at the top of the screen, which will display existing variables in a separate screen:
CLI
To display environment variables, use the env get command.
lapps env get [-a/--app appname] [ENVIRONMENT_VARIABLE1] [ENVIRONMENT_VARIABLE2]
Flags:
Flag | Description |
---|---|
-a, --app | (= "") application name |
Unset Environment Variables
DASHBOARD
Once inside your application's detail page, you can click on the ENV Variables button, which will give you the option to delete existing environment variables.
To unset environment variables, use the env unset command.
lapps env unset <ENVIRONMENT_VARIABLE1> [ENVIRONMENT_VARIABLE2] ... [ENVIRONMENT_VARIABLEN] [-a/--app appname] [--no-restart]
Flags:
Flag | Description |
---|---|
-a, --app | (= "") application name |
--no-restart | (= false) unset environment variables without restarting the application |
Updated 3 months ago