Local configuration

Configure resources and configs to use locally.
The context in which tasks and views are executed locally can be customized through local resources, config variables, and environment variables. This configuration is managed via the Studio UI and persisted to an airplane.dev.yaml file.
If your local config file contains sensitive information such as production credentials, do not share the file or check it into source control, as the contents of the dev config file are not encrypted. You may instead want to share it by using a password manager or secure file exchange platform.
For more information on the file format, see the airplane.dev.yaml reference.

Resources

A common use case for local development of tasks is to hit a local resource, e.g. a database that's running locally.

Add a resource

In order to add a new resource, first start the local dev server, as outlined in Starting the studio. Then, select the resources tab on the left sidebar and click the + icon:
The left sidebar will show a list of available resource types, similar to what you might see when creating an Airplane resource in production:
After selecting a resource type, you'll be prompted to fill in the configuration for that resource:
Click Create, and your resource will be saved to the dev config file!

Config variables

Tasks utilize config variables via environment variables and config attachments. For example, consider a task that has the environment variable STRIPE_API_KEY that references config variable API_KEY. When this task runs, the environment variable STRIPE_API_KEY will be set to the value of the API_KEY config variable.
yaml
Copied
1
// example.task.yaml
2
slug: example
3
envVars:
4
STRIPE_API_KEY:
5
config: API_KEY

Add a config variable

To add a config variable to the dev config file, select the configs tab on the sidebar and click the + icon:
Fill in the name and value of the config variable, and click Create — your new config variable should show up in the config variable listing:

Environment variables

You can specify Studio-wide environment variables. These environment variables override any environment variables specified in your task or view definitions. For example, suppose that we have the following dev configuration file:
yaml
Copied
1
// airplane.dev.yaml
2
envVars:
3
MY_ENV_VAR: bar
And the following task definition:
yaml
Copied
1
// example.task.yaml
2
slug: example
3
envVars:
4
MY_ENV_VAR: foo
When the task is executed, the environment variable MY_ENV_VAR will be set as bar, not foo.

Add an environment variable

To add an environment variable to the dev config file, select the environment variables tab on the sidebar and click the + icon:
Fill in the name and value of the environment variable, and click Create — your new environment variable should show up in the environment variable listing:

Managing dev config file from the CLI

While the UI-based approach above is recommended, it's possible to add, update, and delete both resources and configs using the CLI. To do so, we've included a set of airplane dev config subcommands in the CLI to assist in modifying the dev config file, outlined below.

Add or update a resource

Copied
1
$ airplane dev config set-resource
2
? What's the slug of your resource? This should match the <alias>: <slug> entry in your resource attachments. my_db
3
? What's the name of your resource? This should be a human-readable name for your resource. My database
4
? What's your resource kind? Available kinds:
5
- bigquery
6
- mailgun
7
- mongodb
8
- mysql
9
- postgres
10
- redshift
11
- rest
12
- sendgrid
13
- slack
14
- smtp
15
- snowflake
16
- sqlserver
17
> postgres
18
? Enter postgres resource `username`: postgres
19
? Enter postgres resource `host`: localhost
20
? Enter postgres resource `port`: 5432
21
? Enter postgres resource `database`: postgres
22
? Enter postgres resource `password`: password
23
? Enter postgres resource `ssl`: disable
24
? Enter postgres resource `dsn`:
25
? Enter postgres resource `sshHost`:
26
? Enter postgres resource `sshPort`:
27
? Enter postgres resource `sshUsername`:
28
? Enter postgres resource `sshPrivateKey`:
29
Successfully wrote resource `my_db` of kind `postgres` to dev config file.

Delete a resource

Copied
1
$ airplane dev config delete-resource my_database
2
Removed resource with slug my_database from dev config file, if it existed.

Add or update a config variable

Copied
1
$ airplane dev config set-configvar API_KEY=test
2
Successfully wrote config variable "API_KEY" to dev config file.

Delete a config variable

Copied
1
$ airplane dev config delete-configvar API_KEY
2
Deleted config variable "API_KEY" from dev config file.

Reference

See the airplane.dev.yaml reference for more information.