docs: tidy up sync env vars note blocks (#2817)
This commit is contained in:
@@ -71,33 +71,40 @@ export default defineConfig({
|
||||
|
||||
The `syncVercelEnvVars` build extension syncs environment variables from your Vercel project to Trigger.dev.
|
||||
|
||||
<Note>
|
||||
You need to set the `VERCEL_ACCESS_TOKEN` and `VERCEL_PROJECT_ID` environment variables, or pass
|
||||
in the token and project ID as arguments to the `syncVercelEnvVars` build extension. If you're
|
||||
working with a team project, you'll also need to set `VERCEL_TEAM_ID`, which can be found in your
|
||||
team settings. You can find / generate the `VERCEL_ACCESS_TOKEN` in your Vercel
|
||||
[dashboard](https://vercel.com/account/settings/tokens). Make sure the scope of the token covers
|
||||
the project with the environment variables you want to sync.
|
||||
</Note>
|
||||
<AccordionGroup>
|
||||
<Accordion title="Setting up authentication including team projects">
|
||||
You need to set the `VERCEL_ACCESS_TOKEN` and `VERCEL_PROJECT_ID` environment variables, or pass
|
||||
in the token and project ID as arguments to the `syncVercelEnvVars` build extension. If you're
|
||||
working with a team project, you'll also need to set `VERCEL_TEAM_ID`, which can be found in your
|
||||
team settings.
|
||||
|
||||
<Note>
|
||||
When running the build from a Vercel build environment (e.g., during a Vercel deployment), the
|
||||
environment variable values will be read from `process.env` instead of fetching them from the
|
||||
Vercel API. This is determined by checking if the `VERCEL` environment variable is present. The
|
||||
API is still used to determine which environment variables are configured for your project, but
|
||||
the actual values come from the local environment. Reading values from `process.env` allows the
|
||||
extension to use values that Vercel integrations (such as the Neon integration) set per preview
|
||||
deployment in the "Provisioning Integrations" phase that happens just before the Vercel build
|
||||
starts.
|
||||
</Note>
|
||||
You can find / generate the `VERCEL_ACCESS_TOKEN` in your Vercel
|
||||
[dashboard](https://vercel.com/account/settings/tokens). Make sure the scope of the token covers
|
||||
the project with the environment variables you want to sync.
|
||||
</Accordion>
|
||||
|
||||
<Note>
|
||||
If you have the Neon database Vercel integration installed and are running builds outside of the
|
||||
Vercel environment, we recommend using `syncNeonEnvVars` in addition to `syncVercelEnvVars` for your
|
||||
database environment variables. This ensures that the correct database connection strings are used for your
|
||||
selected environment and current branch, as `syncVercelEnvVars` may not accurately reflect
|
||||
branch-specific database credentials when run locally.
|
||||
</Note>
|
||||
<Accordion title="Running in Vercel build environment">
|
||||
When running the build from a Vercel build environment (e.g., during a Vercel deployment), the
|
||||
environment variable values will be read from `process.env` instead of fetching them from the
|
||||
Vercel API. This is determined by checking if the `VERCEL` environment variable is present.
|
||||
|
||||
The API is still used to determine which environment variables are configured for your project, but
|
||||
the actual values come from the local environment. Reading values from `process.env` allows the
|
||||
extension to use values that Vercel integrations (such as the Neon integration) set per preview
|
||||
deployment in the "Provisioning Integrations" phase that happens just before the Vercel build
|
||||
starts.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Using with Neon database Vercel integration">
|
||||
If you have the Neon database Vercel integration installed and are running builds outside of the
|
||||
Vercel environment, we recommend using `syncNeonEnvVars` in addition to `syncVercelEnvVars` for your
|
||||
database environment variables.
|
||||
|
||||
This ensures that the correct database connection strings are used for your
|
||||
selected environment and current branch, as `syncVercelEnvVars` may not accurately reflect
|
||||
branch-specific database credentials when run locally.
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
```ts
|
||||
import { defineConfig } from "@trigger.dev/sdk";
|
||||
@@ -138,25 +145,29 @@ export default defineConfig({
|
||||
|
||||
The `syncNeonEnvVars` build extension syncs environment variables from your Neon database project to Trigger.dev. It automatically detects branches and builds the appropriate database connection strings for your environment.
|
||||
|
||||
<Note>
|
||||
You need to set the `NEON_ACCESS_TOKEN` and `NEON_PROJECT_ID` environment variables, or pass them
|
||||
as arguments to the `syncNeonEnvVars` build extension. You can generate a `NEON_ACCESS_TOKEN` in
|
||||
your Neon [dashboard](https://console.neon.tech/app/settings/api-keys).
|
||||
</Note>
|
||||
<AccordionGroup>
|
||||
<Accordion title="Setting up authentication">
|
||||
You need to set the `NEON_ACCESS_TOKEN` and `NEON_PROJECT_ID` environment variables, or pass them
|
||||
as arguments to the `syncNeonEnvVars` build extension.
|
||||
|
||||
<Note>
|
||||
When running the build from a Vercel environment (determined by checking if the `VERCEL`
|
||||
environment variable is present), this extension is skipped entirely. This is because Neon's
|
||||
Vercel integration already handles environment variable synchronization in Vercel environments.
|
||||
</Note>
|
||||
You can generate a `NEON_ACCESS_TOKEN` in your Neon [dashboard](https://console.neon.tech/app/settings/api-keys).
|
||||
</Accordion>
|
||||
|
||||
<Note>
|
||||
If you have the Neon database Vercel integration installed and are running builds outside of the
|
||||
Vercel environment, we recommend using `syncNeonEnvVars` in addition to `syncVercelEnvVars` for your
|
||||
database environment variables. This ensures that the correct database connection strings are used for your
|
||||
selected environment and current branch, as `syncVercelEnvVars` may not accurately reflect
|
||||
branch-specific database credentials when run locally.
|
||||
</Note>
|
||||
<Accordion title="Running in Vercel environment">
|
||||
When running the build from a Vercel environment (determined by checking if the `VERCEL`
|
||||
environment variable is present), this extension is skipped entirely.
|
||||
|
||||
This is because Neon's Vercel integration already handles environment variable synchronization in Vercel environments.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Using with Neon database Vercel integration">
|
||||
If you have the Neon database Vercel integration installed and are running builds outside of the
|
||||
Vercel environment, we recommend using `syncNeonEnvVars` in addition to `syncVercelEnvVars` for your
|
||||
database environment variables.
|
||||
|
||||
This ensures that the correct database connection strings are used for your selected environment and current branch, as `syncVercelEnvVars` may not accurately reflect branch-specific database credentials when run locally.
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
<Note>
|
||||
This extension is skipped for `prod` environments. It is designed to sync branch-specific
|
||||
|
||||
Reference in New Issue
Block a user