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
- When the entire value is a single placeholder, typed forms produce native values (number/boolean).
166
178
- When used inside larger strings (e.g. `"http://%env(API_HOST)%/v1"`), placeholders are interpolated as text.
167
-
- **TypeScript configs**: call `env("DB_HOST")`; the helper is available globally when the module is evaluated
168
-
- For tighter autocomplete you can build a project-local accessor via `createEnvAccessor(["DB_HOST", "DB_PORT"] as const)`
179
+
- **Inline objects**: placeholders work the same way; combine them with Zod preprocessors for complex shapes (arrays, URLs, etc.).
169
180
170
181
The `env()` helper throws when the variable is missing. Provide a default with `env("PORT", { default: "3000" })` or switch to `env.optional("PORT")`.
171
182
172
183
### Dotenv loading
173
184
174
-
`loadConfig` automatically understands `.env` files when the `env` option is provided. The resolver honours the following precedence, mirroring Symfony's Dotenv component:
185
+
`defineConfig` automatically understands `.env` files when the `env` option is provided. The resolver honours the following precedence, mirroring Symfony's Dotenv component:
175
186
176
187
1. `.env` (or `.env.dist` when `.env` is missing)
177
188
2. `.env.local` (skipped when `NODE_ENV === "test"`)
0 commit comments