-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.schema
More file actions
34 lines (26 loc) · 911 Bytes
/
.env.schema
File metadata and controls
34 lines (26 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { z } from "zod"
const schema = z.object({
// --- App ---
NODE_ENV: z
.enum(["development", "production", "test"])
.default("development"),
// --- Tauri dev server ---
// The port Vite listens on during development.
// Tauri reads this to know where to point its webview.
VITE_DEV_SERVER_PORT: z.coerce.number().default(1420),
// --- Feature flags (opt-in during development) ---
VITE_ENABLE_DEVTOOLS: z
.enum(["true", "false"])
.default("false")
.transform((v) => v === "true"),
// --- Telemetry (optional, only when you add it) ---
// VITE_SENTRY_DSN: z.string().url().optional(),
})
export type Env = z.infer<typeof schema>
const parsed = schema.safeParse(process.env)
if (!parsed.success) {
console.error("❌ Invalid environment variables:")
console.error(parsed.error.flatten().fieldErrors)
process.exit(1)
}
export const env: Env = parsed.data