Environment Variables

Applications running on Shipa have the capability of using environment variables to handle configurations. As an example, if users need to connect with a third-party service like the Twitter API, the application is potentially going to need things like an api_key.

Using Shipa, the recommended way to expose these values to applications is by using environment variables. To make this easy, Shipa 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 Shipa's dashboard by clicking on the Applications link of your Shipa dashboard, which will take you to the application management screen.

Click on the application, which will show you the ENV variables button.

Click on ENV Variables will give you the following options:

Click on the Set 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 Shipa to restart the app when variables are set automatically

CLI

To set environment variables for an application, use the env set command.

shipa 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 an application's environment variables using Shipa's dashboard by clicking on the Applications link of your Shipa dashboard, which will take you to the application management screen.

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.

shipa 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 an option to delete existing environment variables.

To unset environment variables, use the env unset command.

shipa 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


Did this page help you?