summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/integrations/cloudflare/README.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/integrations/cloudflare/README.md b/packages/integrations/cloudflare/README.md
index 2ca3bfac5..bb59b5658 100644
--- a/packages/integrations/cloudflare/README.md
+++ b/packages/integrations/cloudflare/README.md
@@ -55,3 +55,17 @@ In order to work around this:
- install the `"web-streams-polyfill"` package
- add `import "web-streams-polyfill/es2018";` to the top of the front matter of every page which requires streams, such as server rendering a React component.
+## Environment Variables
+
+As Cloudflare Pages Functions [provides environment variables differently](https://developers.cloudflare.com/pages/platform/functions/#adding-environment-variables-locally), private environment variables needs to be set through [`vite.define`](https://vitejs.dev/config/shared-options.html#define) to work in builds.
+
+```js
+// astro.config.mjs
+export default {
+ vite: {
+ define: {
+ 'process.env.MY_SECRET': JSON.stringify(process.env.MY_SECRET),
+ },
+ },
+}
+```