- Add incident reporting routes and logic to handle creation, updating, and retrieval of incidents. - Implement visibility rules for users based on roles (reporters, supervisors). - Create tests for incident reporting functionality to ensure correctness and reliability. - Introduce site and area management routes, including validation for area hierarchy. - Establish user management routes with role-based access control for creating and updating users. - Add setup routes for initializing the application with an organization and admin user. - Implement shared enums and schemas for consistent validation and data handling across the application. - Create a test helper for setting up an in-memory database and API client for testing. - Add TypeScript configuration for server-side code with strict type checking and module resolution.
23 lines
707 B
TypeScript
23 lines
707 B
TypeScript
export interface Config {
|
|
databaseUrl: string
|
|
port: number
|
|
/** Public URL users open in their browser; HTTPS here turns on secure cookies. */
|
|
publicUrl: string
|
|
secureCookies: boolean
|
|
production: boolean
|
|
/** Built web app to serve, if present. */
|
|
staticDir: string
|
|
}
|
|
|
|
export function loadConfig(env: NodeJS.ProcessEnv = process.env): Config {
|
|
const publicUrl = env.PUBLIC_URL ?? `http://localhost:${env.PORT ?? 3000}`
|
|
return {
|
|
databaseUrl: env.DATABASE_URL ?? 'pglite://./data/pglite',
|
|
port: Number(env.PORT ?? 3000),
|
|
publicUrl,
|
|
secureCookies: publicUrl.startsWith('https://'),
|
|
production: env.NODE_ENV === 'production',
|
|
staticDir: env.STATIC_DIR ?? 'dist',
|
|
}
|
|
}
|