Files
zopu-code/packages/env/src/server.ts
-Puter 6de7c3065e Consolidate env at repo root
- Move all application env vars to repository-root .env (with .env.example
  as the committed template) and drop the per-app .env.example files.
- Add @code/env subpaths (agent, convex) and consume validated exports
  everywhere instead of reading process.env directly.
- Wire every dev/build/start script to load ../../.env via bun --env-file
  and point vite.config.ts envDir at the repo root.
2026-07-19 17:29:11 +05:30

24 lines
869 B
TypeScript

import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";
const convexUrlSchema = (exampleHost: string) =>
z.url().refine((url) => new URL(url).hostname !== exampleHost, {
message: `Replace the ${exampleHost} placeholder before running the app`,
});
export const env = createEnv({
server: {
CONVEX_URL: convexUrlSchema("example.convex.cloud"),
DAEMON_ID: z.string().min(1),
DAEMON_NAME: z.string().min(1).optional(),
DAEMON_VERSION: z.string().default("0.0.0"),
DAEMON_HEARTBEAT_MS: z.coerce.number().int().positive().default(15_000),
DAEMON_COMMAND_LEASE_MS: z.coerce.number().int().positive().default(60_000),
FLUE_DB_TOKEN: z.string().min(1),
RIVET_ENDPOINT: z.url().optional(),
},
runtimeEnv: process.env,
skipValidation: process.env.SKIP_ENV_VALIDATION === "true",
emptyStringAsUndefined: true,
});