@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
mdx 102 lines 3.82 KB
Raw
1 ---
2 title: Doppler
3 description: Load a Doppler config into your Stack — log in with the browser on your machine, use a service token in CI.
4 ---
5
6 [Doppler](https://www.doppler.com) organises secrets into projects,
7 each with configs such as `dev`, `stg`, and `prd`. `Doppler.Secrets`
8 downloads one config into the stack's
9 [secret providers](/environments/secret-providers), without writing
10 anything to `process.env` or to disk. It ships in the
11 `@alchemy.run/doppler` package.
12
13 ```typescript
14 import * as Doppler from "@alchemy.run/doppler";
15
16 secrets: [
17 Doppler.Secrets(({ stage }) => ({
18 project: "my-app",
19 config: stage === "prod" ? "prd" : "dev",
20 })),
21 ],
22 ```
23
24 Browser login and personal tokens are not scoped to a single config,
25 so `project` and `config` are required with those. A
26 [service token](https://docs.doppler.com/docs/service-tokens) is
27 scoped to one config, so both may be omitted. Doppler's
28 [branch configs](https://docs.doppler.com/docs/branch-configs) map
29 neatly onto preview stages if `pr-42` should inherit from `dev`.
30
31 ## Connect your account
32
33 Run `alchemy profile edit --add Doppler`. **Login** opens the Doppler
34 dashboard; approve the request and the token is stored in your
35 [profile](/environments/profiles). It shows up in Doppler as
36 `Alchemy (<your hostname>)`, and
37 `alchemy profile edit --remove Doppler` revokes it. **API token**
38 takes a service or
39 [personal token](https://docs.doppler.com/docs/personal-tokens) you
40 already have. Non-interactively:
41
42 ```sh
43 alchemy profile edit --add Doppler --method api-token --set token=env:DOPPLER_TOKEN
44 ```
45
46 ## In CI
47
48 Profiles are never consulted in CI; the environment decides. The
49 simplest is a service token in `DOPPLER_TOKEN`:
50
51 ```yaml
52 - run: bun alchemy deploy --stage prod --yes
53 env:
54 DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
55 ```
56
57 On Doppler's Team and Enterprise plans, use OIDC to avoid storing a
58 long-lived Doppler token. Create a
59 [service account identity](https://docs.doppler.com/docs/service-account-identities)
60 that trusts your platform's OIDC issuer and set `DOPPLER_IDENTITY_ID`;
61 Alchemy exchanges the platform's own identity token for a short-lived
62 Doppler token on every run:
63
64 ```yaml
65 jobs:
66 deploy:
67 permissions:
68 id-token: write # lets the job request an OIDC token
69 contents: read
70 steps:
71 - run: bun alchemy deploy --stage prod --yes
72 env:
73 DOPPLER_IDENTITY_ID: ${{ vars.DOPPLER_IDENTITY_ID }}
74 ```
75
76 Alchemy detects GitHub Actions, Vercel, and supported
77 Google Cloud runtimes. Each platform must be configured to issue a token
78 whose issuer, subject, and audience match the Doppler identity's trust policy.
79 Use your job's actual subject claim when configuring that policy; it can
80 vary with the repository, branch, environment, and organization settings.
81
82 For GitLab, name the token in the job's
83 [`id_tokens`](https://docs.gitlab.com/ci/secrets/id_token_authentication/)
84 block `DOPPLER_OIDC_TOKEN` and set its `aud` to the audience trusted by
85 Doppler. `SIGSTORE_ID_TOKEN` is also detected when `GITLAB_CI` is set.
86 On other platforms, `DOPPLER_OIDC_TOKEN` accepts an explicitly supplied token.
87
88 `DOPPLER_OIDC_AUDIENCE` sets the requested audience on GitHub Actions
89 and Google Cloud. It is required for Google's
90 [metadata identity endpoint](https://docs.cloud.google.com/docs/authentication/get-id-token).
91 It does not change the audience of tokens already supplied by Vercel,
92 GitLab, or `DOPPLER_OIDC_TOKEN`.
93
94 `DOPPLER_TOKEN` wins over `DOPPLER_IDENTITY_ID`, and either wins over
95 a profile, so a teammate can deploy with a token they were handed.
96 `alchemy provider check-env` lists these variables.
97
98 ## Where next
99
100 - [Secret providers](/environments/secret-providers) — ordering, mixing sources, and per-stage callbacks.
101 - [Profiles](/environments/profiles) — where the login lives.
102 - [Doppler docs](https://docs.doppler.com) — projects, configs, and access control.