Restructure upload validation env and colocate config types.

Move app config shapes under types/config, replace batch upload env vars with
per-image bytes and JSON body padding, and extend IsBase64 for decoded limits.
This commit is contained in:
2026-10-12 20:18:22 +02:00
parent 4b7f8459cb
commit 96383a7426
15 changed files with 90 additions and 29 deletions
+16 -10
View File
@@ -45,12 +45,6 @@ class EnvironmentVariables {
@IsString()
CORS_ORIGINS: string;
@IsNotEmpty()
@IsNumber()
@Min(1)
@Max(50 * 1024 * 1024)
MULTER_MAX_FILE_BYTES: number;
@IsNotEmpty()
@IsIn(BOOLEAN_STRING_VALUES)
ALTCHA_ENABLED: BooleanStringValue;
@@ -65,6 +59,12 @@ class EnvironmentVariables {
@Max(1_000_000)
ALTCHA_MAX_NUMBER: number;
@IsNotEmpty()
@IsNumber()
@Min(60_000)
@Max(3_600_000)
ALTCHA_CHALLENGE_TTL_MS: number;
@IsNotEmpty()
@IsNumber()
@Min(1)
@@ -98,14 +98,20 @@ class EnvironmentVariables {
@IsNotEmpty()
@IsNumber()
@Min(1)
@Max(100)
VALIDATION_UPLOAD_MAX_IMAGES_PER_UPLOAD: number;
@Max(10_000_000)
VALIDATION_UPLOAD_MAX_VIEWS_MAX: number;
@IsNotEmpty()
@IsNumber()
@Min(1)
@Max(10_000_000)
VALIDATION_UPLOAD_MAX_VIEWS_MAX: number;
@Max(50 * 1024 * 1024) // 50MB
VALIDATION_UPLOAD_MAX_IMAGE_BYTES: number;
@IsNotEmpty()
@IsNumber()
@Min(256 * 1024) // 256KiB
@Max(16 * 1024 * 1024) // 16MB
VALIDATION_UPLOAD_JSON_BODY_PADDING_BYTES: number;
}
export const validate = (config: Record<string, unknown>) => {