Integrating with Doppler

Doppler is a third-party service for managing secrets. To integrate, you can use the Doppler API to fetch secrets at the start of your task.

Authenticating with Doppler

To authenticate, you'll need a Doppler Service Token. We recommend storing it as a secret config variable and attaching it to your task as an environment variable.

Example code

We'll use the gitops-secrets library from Doppler to fetch secrets from the Doppler API.
shell
Copied
1
npm install gitops-secrets
Assuming DOPPLER_TOKEN is configured, you can fetch secrets with just a few lines of code:
typescript
Copied
1
// get_doppler_secret.airplane.ts
2
import airplane from "airplane";
3
import secrets from "gitops-secrets";
4
5
export default airplane.task(
6
{
7
slug: "get_doppler_secret",
8
name: "Get Doppler secret",
9
envVars: {
10
DOPPLER_TOKEN: { config: "DOPPLER_TOKEN" },
11
},
12
},
13
async () => {
14
// You can access payload.YOUR_SECRET directly:
15
const payload = await secrets.providers.doppler.fetch();
16
// Or populate it into process.env.YOUR_SECRET:
17
secrets.populateEnv(payload);
18
},
19
);