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
- id: res-db
4
slug: db
5
name: My database
6
kind: postgres
7
host: localhost
8
port: "5432"
9
ssl: disable
10
username: postgres
11
password: password
12
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 you 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, run:
bash
Copied
1
airplane dev config delete-resource <slug>

Managing resources from the CLI

It's possible to add or update resources in the dev config file using the CLI (although the Studio approach is recommended). To do so, run airplane dev config set-resource and follow the prompts on the screen to enter in your resource details.
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.

Config variables

Config variables are passed into your task via environment variables.
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, run:
bash
Copied
1
airplane dev config set-configvar <key> <value>

Delete a config variable

To remove a config variable from the dev config file, run:
bash
Copied
1
airplane dev config delete-configvar <key>

References

The following is a complete reference of fields supported in 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
- id: res-db
4
slug: db
5
name: My database
6
kind: postgres
7
# The following fields are resource-specific.
8
host: localhost
9
port: "5432"
10
ssl: disable
11
username: postgres
12
password: password
13
database: postgres

Common fields

idstringREQUIRED
The id of the resource—this should be of the form res-{slug}, where {slug} is the slug defined above.
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.
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 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
envVars:
3
API_KEY: 1234
4
<key>: <value>
<key>stringREQUIRED
The name of the config variable.
<value>stringREQUIRED
The value of the config variable.