You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**BREAKING CHANGE to the experimental `astro:env` feature only**
6
+
7
+
Server secrets specified in the schema must now be imported from `astro:env/server`. Using `getSecret()` is no longer required to use these environment variables in your schema:
8
+
9
+
```diff
10
+
- import { getSecret } from 'astro:env/server'
11
+
- const API_SECRET = getSecret("API_SECRET")
12
+
+ import { API_SECRET } from 'astro:env/server'
13
+
```
14
+
15
+
Note that using `getSecret()` with these keys is still possible, but no longer involves any special handling and the raw value will be returned, just like retrieving secrets not specified in your schema.
* There are currently three data types supported: strings, numbersand booleans.
2107
+
* There are currently four data types supported: strings, numbers, booleans and enums.
2108
2108
*
2109
2109
* There are three kinds of environment variables, determined by the combination of `context` (client or server) and `access` (secret or public) settings defined in your [`env.schema`](#experimentalenvschema):
2110
2110
*
2111
2111
* - **Public client variables**: These variables end up in both your final client and server bundles, and can be accessed from both client and server through the `astro:env/client` module:
2112
2112
*
2113
2113
* ```js
2114
-
* import { PUBLIC_API_URL } from "astro:env/client"
2114
+
* import { API_URL } from "astro:env/client"
2115
2115
* ```
2116
2116
*
2117
2117
* - **Public server variables**: These variables end up in your final server bundle and can be accessed on the server through the `astro:env/server` module:
2118
2118
*
2119
2119
* ```js
2120
-
* import { PUBLIC_PORT } from "astro:env/server"
2120
+
* import { PORT } from "astro:env/server"
2121
2121
* ```
2122
2122
*
2123
-
* - **Secret server variables**: These variables are not part of your final bundle and can be accessed on the server through the `getSecret()` helper function available from the `astro:env/server` module:
2123
+
* - **Secret server variables**: These variables are not part of your final bundle and can be accessed on the server through the `astro:env/server` module. The `getSecret()` helper function can be used to retrieve secrets not specified in the schema:
2124
2124
*
2125
2125
* ```js
2126
-
* import { getSecret } from "astro:env/server"
2126
+
* import { API_SECRET, getSecret } from "astro:env/server"
0 commit comments