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

docs(guides/envvars): update @remix-run/cloudflare-pages docs #3804

Merged
merged 5 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- ashleyryan
- ashocean
- athongsavath
- awthwathje
- axel-habermaier
- BasixKOR
- BenMcH
Expand Down
14 changes: 1 addition & 13 deletions docs/guides/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,7 @@ export async function loader() {
}
```

If you're using the `@remix-run/cloudflare-pages` adapter, env variables work a little differently. You'll need to manually pass your `.env` file to `wrangler` by doing this:

```json
// package.json

{
"scripts": {
"dev:wrangler": "cross-env NODE_ENV=development wrangler pages dev ./public --binding $(cat .env)"
}
}
```

<docs-info>Learn more about <a href="https://npm.im/cross-env"><code>cross-env</code></a></docs-info>
If you're using the `@remix-run/cloudflare-pages` adapter, env variables work a little differently. Since Cloudflare Pages are powered by Functions, you'll need to define your local environment variables in the [`.dev.vars`](https://developers.cloudflare.com/pages/platform/functions/#adding-environment-variables-locally) file. It has the same syntax as `.env` example file mentioned above.

Then, in your `loader` functions, you can access environment variables directly on `context`:

Expand Down