mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-24 21:16:40 +02:00
fix: add @Type(() => Number) for numeric env var conversion
Environment variables are strings from process.env. Explicit Type decorators ensure class-transformer converts them to numbers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5214d5e0f7
commit
2059fa69d9
1 changed files with 6 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { plainToInstance } from 'class-transformer';
|
||||
import { plainToInstance, Type } from 'class-transformer';
|
||||
import {
|
||||
IsEnum,
|
||||
IsNotEmpty,
|
||||
|
|
@ -20,6 +20,7 @@ class EnvironmentVariables {
|
|||
@IsEnum(Environment)
|
||||
NODE_ENV: Environment = Environment.Development;
|
||||
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
@Max(65535)
|
||||
|
|
@ -42,6 +43,7 @@ class EnvironmentVariables {
|
|||
@IsString()
|
||||
REDIS_HOST = 'redis';
|
||||
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
REDIS_PORT = 6379;
|
||||
|
||||
|
|
@ -68,15 +70,18 @@ class EnvironmentVariables {
|
|||
JWT_ISSUER = 'insight-platform';
|
||||
|
||||
// Bcrypt
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(10)
|
||||
@Max(14)
|
||||
BCRYPT_COST = 12;
|
||||
|
||||
// Rate Limiting
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
THROTTLE_TTL = 60000;
|
||||
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
THROTTLE_LIMIT = 200;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue