- record a trace for each scenario run and upload it as trace.zip - add PLAYWRIGHT_TRACE_MODE (on, retain-on-failure, off) as the default - add a trace mode option to the run modal, stored per run and reused by repeat run; expose the default via GET /scenarios/run-defaults - accept traceMode in POST /scenarios/:id/run and run_scenario MCP tool - share one run modal component between scenario list and detail pages - git-ignore server/data
72 lines
1.3 KiB
TypeScript
72 lines
1.3 KiB
TypeScript
import { plainToInstance } from "class-transformer";
|
|
import {
|
|
IsEnum,
|
|
IsInt,
|
|
IsString,
|
|
Max,
|
|
Min,
|
|
validateSync,
|
|
} from "class-validator";
|
|
|
|
import pkg from "../../package.json";
|
|
|
|
export enum TraceMode {
|
|
On = "on",
|
|
RetainOnFailure = "retain-on-failure",
|
|
Off = "off",
|
|
}
|
|
|
|
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/liqa.db";
|
|
|
|
@IsInt()
|
|
@Min(1)
|
|
SESSION_IDLE_TIMEOUT_MINUTES: number = 30;
|
|
|
|
@IsInt()
|
|
@Min(1)
|
|
SESSION_DELETE_CLOSED_DAYS: number = 7;
|
|
|
|
@IsString()
|
|
FILES_DIR: string = "data/files";
|
|
|
|
@IsInt()
|
|
@Min(1)
|
|
FILE_RUN_EXPIRATION_DAYS: number = 7;
|
|
|
|
@IsString()
|
|
FILE_CLEANUP_CRON: string = "0 3 * * *";
|
|
|
|
@IsEnum(TraceMode)
|
|
PLAYWRIGHT_TRACE_MODE: TraceMode = TraceMode.On;
|
|
}
|
|
|
|
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;
|
|
}
|