forked from Yara724/api
Added AI damage helper
This commit is contained in:
@@ -108,4 +108,17 @@ export class EnvironmentVariables {
|
||||
})
|
||||
CLAIM_V2_TOTAL_PAYMENT_CAP_TOMAN?: number;
|
||||
// --------------------------------------------------------- //
|
||||
@IsOptional()
|
||||
@IsBooleanString()
|
||||
AI_DAMAGE_ENABLED?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUrl({ require_tld: false })
|
||||
AI_DAMAGE_URL?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(1000)
|
||||
@Max(600000)
|
||||
AI_DAMAGE_TIMEOUT_MS?: number;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,13 @@ export function validate(config: Record<string, unknown>) {
|
||||
enableImplicitConversion: true,
|
||||
});
|
||||
|
||||
if (
|
||||
validatedConfig.AI_DAMAGE_ENABLED === "true" &&
|
||||
!validatedConfig.AI_DAMAGE_URL
|
||||
) {
|
||||
throw new Error("AI_DAMAGE_URL is required when AI_DAMAGE_ENABLED=true");
|
||||
}
|
||||
|
||||
const errors = validateSync(validatedConfig, {
|
||||
skipMissingProperties: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user