feat: migrate app to local Fastify and Postgres stack
Replace Supabase auth and search runtime with a local Fastify API, PostgreSQL/PostGIS schema, and local session handling. Scaffold the worker and deep-research foundations while keeping the existing research, dashboard, and map flows running on the new backend.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const envSchema = z.object({
|
||||
NODE_ENV: z.enum(['development', 'test', 'production']).default('development'),
|
||||
APP_HOST: z.string().default('0.0.0.0'),
|
||||
APP_PORT: z.coerce.number().int().positive().default(4000),
|
||||
APP_ORIGIN: z.string().default('http://localhost:3000'),
|
||||
DATABASE_URL: z.string().min(1, 'DATABASE_URL is required'),
|
||||
COOKIE_SECRET: z.string().min(1, 'COOKIE_SECRET is required'),
|
||||
GOOGLE_MAPS_SERVER_KEY: z.string().optional(),
|
||||
PG_BOSS_SCHEMA: z.string().default('pgboss'),
|
||||
SESSION_TTL_DAYS: z.coerce.number().int().positive().default(30),
|
||||
});
|
||||
|
||||
export type AppEnv = z.infer<typeof envSchema>;
|
||||
|
||||
let cachedEnv: AppEnv | null = null;
|
||||
|
||||
export function getEnv(): AppEnv {
|
||||
if (cachedEnv) {
|
||||
return cachedEnv;
|
||||
}
|
||||
|
||||
cachedEnv = envSchema.parse(process.env);
|
||||
return cachedEnv;
|
||||
}
|
||||
Reference in New Issue
Block a user