Dev config file

Define resource configuration and config variables for local development.
The development environment in which tasks are executed locally can be customized with a dev config file. This file can be used to configure resources and set config variables.
By default, the airplane CLI will use a file called airplane.dev.yaml, and will traverse upwards through any parent directories until this file is found. For all of the commands below, you can add an optional flag --config-path that tells the CLI where to look for a dev config file, and any modifications will occur in that 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.

Resources

yaml
Copied
1
# airplane.dev.yaml
2
resources:
3
- slug: db
4
name: My database
5
kind: postgres
6
host: localhost
7
port: "5432"
8
ssl: disable
9
username: postgres
10
password: password
11
database: postgres
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!

Update a resource

Updating a resource is similar to adding one—simply select the resource from the left sidebar, modify any fields, and click Update:

Delete a resource

To delete a resource from the dev config file, select the dropdown menu for that resource, and click Delete:

Config variables

Config variables are passed into your task via environment variables or config attachments.
yaml
Copied
1
// airplane.dev.yaml
2
configVars:
3
API_KEY: 1234
In the above dev config file, we created a config variable with key API_KEY and value 1234. In our task definition file below, we created an environment variable MY_ENV_VAR that references config variable API_KEY. When the task runs, the environment variable MY_ENV_VAR will be set to value 1234.
yaml
Copied
1
// example.task.yaml
2
slug: example
3
envVars:
4
MY_ENV_VAR:
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:

Update a config variable

To update a config, click the Edit button next to the config you'd like to update, fill in the new value, and click Update:

Delete a config variable

To remove a config variable, click the Edit button of the config you'd like to remove, and click Delete:

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

As shown above, you can modify your dev config file through the studio UI or CLI. However, you can also modify your dev config file directly through your editor of choice. The following is a complete reference of fields supported by the dev config file.

Resource

Resources are registered with the local dev server when developing a task locally.
resourceslistoptional
Top-level field that stores a list of resources.
yaml
Copied
1
// airplane.dev.yaml
2
resources:
3
- slug: db
4
name: My database
5
kind: postgres
6
# The following fields are resource-specific.
7
host: localhost
8
port: "5432"
9
ssl: disable
10
username: postgres
11
password: password
12
database: postgres

Common fields

slugstringREQUIRED
A unique identifier that is used to reference the resource in a task. This should match the slug that's included in your resource attachments.
namestringREQUIRED
A human-readable name for the resource.
kindstringREQUIRED
The kind of the resource—for a complete list of resource kinds, see the Resource page.

Resource-specific fields

For an exhaustive list of fields that a resource of a specific kind can support, navigate to that resource's page.

Config variable

Config variables are referenced by environment variables and config attachments and are loaded into the runtime when developing a task locally.
configVarsobjectoptional
Top-level field that stores a map of config variables.
yaml
Copied
1
// airplane.dev.yaml
2
configVars:
3
API_KEY: 1234
4
<key>: <value>
<key>stringREQUIRED
The name of the config variable.
<value>stringREQUIRED
The value of the config variable.