chore(repo): restructure as monorepo with server and client workspaces
- move NestJS app into server/ subdirectory - add client/ React+TypeScript (Vite) app with Hello World - update docker-compose to build and run both services - add root package.json declaring npm workspaces - update .gitignore to cover node_modules and dist at all depths
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { IsInt, IsString, Min, Max } from "class-validator";
|
||||
import { plainToInstance } from "class-transformer";
|
||||
import { validateSync } from "class-validator";
|
||||
|
||||
import pkg from "../../package.json";
|
||||
|
||||
export class AppConfig {
|
||||
@IsString()
|
||||
NODE_ENV: string = "development";
|
||||
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(65535)
|
||||
PORT: number = 3000;
|
||||
|
||||
@IsString()
|
||||
APP_NAME: string = pkg.name;
|
||||
|
||||
@IsString()
|
||||
APP_VERSION: string = pkg.version;
|
||||
|
||||
@IsString()
|
||||
KEYS_DIR: string = "keys";
|
||||
|
||||
@IsString()
|
||||
DB_PATH: string = "data/sessions.db";
|
||||
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
SESSION_IDLE_TIMEOUT_MINUTES: number = 30;
|
||||
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
SESSION_DELETE_CLOSED_DAYS: number = 7;
|
||||
}
|
||||
|
||||
export function validateAppConfig(config: Record<string, unknown>): AppConfig {
|
||||
const validated = plainToInstance(AppConfig, config, {
|
||||
enableImplicitConversion: true,
|
||||
});
|
||||
const errors = validateSync(validated, { skipMissingProperties: false });
|
||||
if (errors.length > 0) {
|
||||
throw new Error(errors.toString());
|
||||
}
|
||||
return validated;
|
||||
}
|
||||
Reference in New Issue
Block a user