Config variables

Configs variables ("config vars") allow you to set team-wide values / secrets and use them in tasks and runbooks.

Managing config vars

To manage config vars, you must be a Team Admin. If you're a Team Admin, you can manage them from the Settings section of the app.

Config vars have a name and an associated string value. Config vars can be secret, in which case the value can be set but will not be exposed to users from the UI. All config vars on Airplane are stored encrypted at rest.

Config var names are flexible, but we recommend the following conventions:

  • db: for simple names use lowercase, one word
  • eng/platform/db: use slashes to group your config vars together
  • db:stage: use a colon to append a tag to your config var name—use tags for different variants of a config var (e.g. staging/production). Tags don't have special behavior currently but may get extra features in the future.

Using config vars in tasks

You can pass in a config var to a task in one of two ways: config attachments and environment variables.

Config attachments

For SQL and REST tasks, you can use configs by attaching them to the task and referencing them in a JavaScript template.

In your task definition file (the file with extension .task.yaml):

yaml
Copied
1
rest:
2
configs:
3
# Where API_KEY is the name of a config var created in the web UI.
4
- API_KEY
5
headers:
6
X-API-KEY: "{{configs.API_KEY}}"

Environment variables

For all other task types, you can utilize configs by creating environment variables that are populated from config variables.

In your task definition file (the file with extension .task.yaml):

yaml
Copied
1
node:
2
envVars:
3
SENDGRID_API_KEY:
4
# Where sendgrid_api_key is the name of a config var created in the web UI.
5
config: sendgrid_api_key

This will pass the config var into the task as an environment variable. Access environment variables in your script using standard patterns:

javascript
Copied
1
const apiKey = process.env.SENDGRID_API_KEY;