diff options
author | 2021-11-23 18:22:15 +0000 | |
---|---|---|
committer | 2021-11-23 18:22:15 +0000 | |
commit | b8b04dc2d37b5f7cdeb2f4caf102102a63f00f81 (patch) | |
tree | 17a47762c77dde1bb90f00c8728e94541e14a727 /docs/src/pages/guides/environment-variables.md | |
parent | e4002f29589ecd4c3f59ccfb1948e08a0c726272 (diff) | |
download | astro-b8b04dc2d37b5f7cdeb2f4caf102102a63f00f81.tar.gz astro-b8b04dc2d37b5f7cdeb2f4caf102102a63f00f81.tar.zst astro-b8b04dc2d37b5f7cdeb2f4caf102102a63f00f81.zip |
[ci] yarn format
Diffstat (limited to 'docs/src/pages/guides/environment-variables.md')
-rw-r--r-- | docs/src/pages/guides/environment-variables.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/src/pages/guides/environment-variables.md b/docs/src/pages/guides/environment-variables.md index 178cb276b..26e19ff7f 100644 --- a/docs/src/pages/guides/environment-variables.md +++ b/docs/src/pages/guides/environment-variables.md @@ -4,7 +4,7 @@ title: Using environment variables description: Learn how to use environment variables in an Astro project. --- -Astro uses Vite for environment variables, and allows you to use any of its methods to get and set environment variables. Note that all environment variables must be prefixed with `PUBLIC_` to be accessible by client side code. +Astro uses Vite for environment variables, and allows you to use any of its methods to get and set environment variables. Note that all environment variables must be prefixed with `PUBLIC_` to be accessible by client side code. The ability to access private variables on the server side is [still being discussed](https://github.com/snowpackjs/astro/issues/1765). @@ -24,7 +24,7 @@ PUBLIC_POKEAPI="https://pokeapi.co/api/v2" Instead of using `process.env`, with Vite you use `import.meta.env`, which uses the `import.meta` feature added in ES2020 (don't worry about browser support though, Vite replaces all `import.meta.env` mentions with static values). For example, to get the `PUBLIC_POKEAPI` environment variable, you could use `import.meta.env.PUBLIC_POKEAPI`. ```js -fetch(`${import.meta.env.PUBLIC_POKEAPI}/pokemon/squirtle`) +fetch(`${import.meta.env.PUBLIC_POKEAPI}/pokemon/squirtle`); ``` > ⚠️WARNING⚠️: |