Using cloudflare vite-plugin, what secrets/bindings do preview urls use for non-production builds?

Is preview its own environment that can be configured in wrangler.toml?
[env.preview]
[env.preview.vars]
BASE_URL = "my-base-url"
CLOUDFLARE_ACCOUNT_ID = "my-cloudflare-id"

[[env.preview.d1_databases]]
binding = "DB"
database_name = "database"
database_id = "my-db-id"
migrations_dir = "drizzle/migrations"
[env.preview]
[env.preview.vars]
BASE_URL = "my-base-url"
CLOUDFLARE_ACCOUNT_ID = "my-cloudflare-id"

[[env.preview.d1_databases]]
binding = "DB"
database_name = "database"
database_id = "my-db-id"
migrations_dir = "drizzle/migrations"
1 Reply
Jay
JayOP12h ago
In addition to these environments, I also have env.production and env.local in my wrangler.toml. Non-prod branch deploy command is: CLOUDFLARE_ENV=preview npx wrangler versions upload With a single worker, I only see one place to add secrets in the Dashboard itself, and attempting to create a env=preview secret via the CLI gives me: There doesn't seem to be a Worker called "app-name-preview". Do you want to create a new Worker with that name and add secrets to it?

Did you find this page helpful?