-
-
Notifications
You must be signed in to change notification settings - Fork 894
docs: improve env var documentation with .env upload + ctx environmen… #2680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs: improve env var documentation with .env upload + ctx environmen… #2680
Conversation
|
WalkthroughThis pull request updates the deployment environment variables documentation file by adding sections that explain how to perform initial environment variable loading using Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs/deploy-environment-variables.mdx (1)
132-162: Expand property reference to include additional available context properties.The documented properties are accurate and the type values are correct and exhaustive. However, the documentation omits several available properties that would benefit users:
ctx.environment.branchName— Present whentype === "PREVIEW"(useful for preview environment workflows)ctx.project.id,ctx.project.slug,ctx.project.name— Available alongside the documentedctx.project.refConsider adding these properties to the reference list to provide users with the complete context API surface.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/deploy-environment-variables.mdx(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: julienvanbeveren
Repo: triggerdotdev/trigger.dev PR: 2417
File: apps/webapp/app/routes/api.v1.projects.$projectRef.envvars.$slug.import.ts:56-61
Timestamp: 2025-08-19T09:49:07.011Z
Learning: In the Trigger.dev codebase, environment variables should default to `isSecret: false` when not explicitly marked as secrets in the syncEnvVars functionality. This is the intended behavior for both regular variables and parent variables.
📚 Learning: 2025-08-19T09:49:07.011Z
Learnt from: julienvanbeveren
Repo: triggerdotdev/trigger.dev PR: 2417
File: apps/webapp/app/routes/api.v1.projects.$projectRef.envvars.$slug.import.ts:56-61
Timestamp: 2025-08-19T09:49:07.011Z
Learning: In the Trigger.dev codebase, environment variables should default to `isSecret: false` when not explicitly marked as secrets in the syncEnvVars functionality. This is the intended behavior for both regular variables and parent variables.
Applied to files:
docs/deploy-environment-variables.mdx
🔇 Additional comments (1)
docs/deploy-environment-variables.mdx (1)
86-130: ---Example 2 in the "task context" section contains incorrect API usage and must be corrected.
The actual
envvars.upload()API requires bothprojectRefandenvparameters as mandatory arguments, not optional context-inferred values. The documentation at lines 108-126 incorrectly shows callingenvvars.upload()with only the options object:// INCORRECT - shown in docs await envvars.upload({ variables: parsed, override: false, });This should be corrected to include the required parameters:
// CORRECT await envvars.upload("proj_your_project_ref", "prod", { variables: parsed, override: false, });Remove the misleading comment about automatic context inference, as the API signature requires explicit projectRef and env arguments.
⛔ Skipped due to learnings
Learnt from: nicktrn Repo: triggerdotdev/trigger.dev PR: 2155 File: hosting/docker/.env.example:4-7 Timestamp: 2025-06-06T23:55:01.933Z Learning: In the trigger.dev project, .env.example files should contain actual example secret values rather than placeholders, as these help users understand the expected format. The files include clear warnings about not using these defaults in production and instructions for generating proper secrets.Learnt from: julienvanbeveren Repo: triggerdotdev/trigger.dev PR: 2417 File: apps/webapp/app/routes/api.v1.projects.$projectRef.envvars.$slug.import.ts:56-61 Timestamp: 2025-08-19T09:49:07.011Z Learning: In the Trigger.dev codebase, environment variables should default to `isSecret: false` when not explicitly marked as secrets in the syncEnvVars functionality. This is the intended behavior for both regular variables and parent variables.
docs: improve env var documentation with .env upload + ctx environment details
Closes #1248
✅ Checklist
Summary
This PR addresses issue #1248 by adding two missing documentation sections to the environment variables guide:
Initial load from .env file: Documents how to use
envvars.upload()to initially load environment variables from a.envfile into Trigger.dev cloud environment. This was previously undocumented.Getting the current environment: Documents how to access the current environment information (
ctx.environment.slug,ctx.environment.type, etc.) when usingenvvars.retrieve(), which previously had no direct way to determine the current environment.Testing
Changelog
ctx.environmentto access environment informationScreenshots
N/A - Documentation only change