Skip to content

Commit b8235ea

Browse files
committed
Adds SDK and curl options for the preview branch targeting
1 parent f7ac047 commit b8235ea

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

docs/management/authentication.mdx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,26 @@ await envvars.upload("proj_1234", "dev", {
100100

101101
When working with preview branches, you may need to target a specific branch when making API calls. This is particularly useful for managing environment variables or other resources that are scoped to individual preview branches.
102102

103-
To target a specific preview branch, include the `x-trigger-branch` header in your API requests with the branch name as the value:
103+
<Tabs>
104+
<Tab title="SDK">
105+
To target a specific preview branch, include the `previewBranch` option in your SDK configuration:
106+
107+
```ts
108+
import { configure, envvars } from "@trigger.dev/sdk";
109+
110+
configure({
111+
secretKey: process.env["TRIGGER_ACCESS_TOKEN"], // starts with tr_pat_
112+
previewBranch: "feature-xyz",
113+
});
114+
115+
await envvars.update("proj_1234", "preview", "DATABASE_URL", {
116+
value: "your_preview_database_url",
117+
});
118+
```
119+
120+
</Tab>
121+
<Tab title="cURL">
122+
To target a specific preview branch, include the `x-trigger-branch` header in your API requests with the branch name as the value:
104123

105124
```bash
106125
curl --request PUT \
@@ -112,7 +131,8 @@ curl --request PUT \
112131
"value": "your_preview_database_url"
113132
}'
114133
```
115-
134+
</Tab>
135+
</Tabs>
116136
This will set the `DATABASE_URL` environment variable specifically for the `feature-xyz` preview branch.
117137

118138
<Note>

0 commit comments

Comments
 (0)