You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deploy-environment-variables.mdx
+78Lines changed: 78 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,84 @@ We have a complete set of SDK functions (and REST API) you can use to directly m
83
83
|[envvars.update()](/management/envvars/update)| Update a single environment variable |
84
84
|[envvars.del()](/management/envvars/delete)| Delete a single environment variable |
85
85
86
+
#### Initial load from .env file
87
+
88
+
To initially load environment variables from a `.env` file into your Trigger.dev cloud environment, you can use `envvars.upload()`. This is useful for one-time bulk imports when setting up a new project or environment.
// projectRef and environment slug are automatically inferred from ctx
120
+
awaitenvvars.upload({
121
+
variables: parsed,
122
+
override: false,
123
+
});
124
+
},
125
+
});
126
+
```
127
+
128
+
<Note>
129
+
This is different from `syncEnvVars` which automatically syncs variables during every deploy. Use `envvars.upload()` for one-time initial loads, and `syncEnvVars` for ongoing synchronization.
130
+
</Note>
131
+
132
+
#### Getting the current environment
133
+
134
+
When using `envvars.retrieve()` inside a task, you can access the current environment information from the task context (`ctx`). The `envvars.retrieve()` function doesn't return the environment, but you can get it from `ctx.environment`:
0 commit comments