import { createEnv } from '@t3-oss/env-core'; import { z } from 'zod'; // Bun reads, in order of increasing precedence: .env, .env.production | .env.development, .env.local // https://bun.sh/guides/runtime/set-env export const env = createEnv({ server: { PORT: z.coerce.number().int().min(1).max(65535).default(3000), // Storage backend for repo snapshots + blobs. Only "local" is implemented // today; the code path goes through a Storage interface so s3/webdav can // be added without touching callers. STORAGE_BACKEND: z.enum(['local']).default('local'), STORAGE_LOCAL_ROOT: z.string().min(1).default('./data/storage'), // SQLite file for the control-plane database (targets, backup index). DATABASE_PATH: z.string().min(1).default('./data/safekeeper.db'), // How often the scheduler wakes up and considers work. Per-account cadence // (daily snapshots, etc.) is enforced inside the scheduler itself. BACKUP_INTERVAL_MS: z.coerce .number() .int() .min(1000) .default(24 * 60 * 60 * 1000), // Leave empty to disable auth (only safe if the panel is bound to // localhost or behind an external reverse proxy that enforces auth). ADMIN_PASSWORD: z.string().default('') }, runtimeEnv: process.env, emptyStringAsUndefined: true });