Skip to content
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

Set secret environment variables in Pages preview deployment #354

Open
lorenzodejong opened this issue Feb 11, 2025 · 0 comments
Open

Set secret environment variables in Pages preview deployment #354

lorenzodejong opened this issue Feb 11, 2025 · 0 comments

Comments

@lorenzodejong
Copy link

Hi!

Currently I'm integrating a Cloudflare Pages application in combination with Worker functions which are connecting to a unique branch of my Postgres Database (using Neon).

However, what I noticed is that there's currently no functionality available to set environment variables (secrets) scoped to my unique preview deployment.

My setup for deploying from Github Actions is very similar to the following example: https://github.com/neondatabase/preview-branches-with-cloudflare/blob/main/.github/workflows/deploy-preview.yml#L42. What i noticed is that they explicitly set the DATABASE_URL in the wrangler.toml.

The downsides of this however:

  • Cloudflare console does not mark these variables as sensitive/secret, but instead outputs them in the UI (especially concerning since it's database credentials).
  • This works to some extent in the wrangler.toml, however when you start introducing environments (e.g. [env.dev]) appending the variables at the end of the wrangler.toml may set the variables for the wrong environment.

Would like to hear if it's an oversight from my end and/or if there's any future plans on supporting this behavior. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant