mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-25 00:16:41 +02:00
- Phase 2.3 Forecast: probability-Feld in PipelineStage, GET /crm/deals/forecast Endpoint - Phase 2.2 Import: ImportModule mit preview/execute/history Endpoints (CSV, XLSX, vCard) - Phase 2.4 Enrichment: EnrichmentModule mit /enrich + /settings/integrations/north-data - Contracts: ContractsModule mit CRUD + File-Upload Endpoints (Multer, max 25MB) - Migrations: 20260312_contract_files, 20260312_phase23_forecast - docker-compose.crm.yml: uploads Volume für Vertragsdokumente Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
80 lines
1.5 KiB
TypeScript
80 lines
1.5 KiB
TypeScript
import { plainToInstance } from 'class-transformer';
|
|
import { IsString, IsNumber, IsOptional, validateSync } from 'class-validator';
|
|
|
|
export class EnvironmentVariables {
|
|
@IsString()
|
|
DATABASE_URL!: string;
|
|
|
|
@IsString()
|
|
DATABASE_URL_DIRECT!: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
REDIS_HOST?: string;
|
|
|
|
@IsNumber()
|
|
@IsOptional()
|
|
REDIS_PORT?: number;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
REDIS_PASSWORD?: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
JWT_PUBLIC_KEY_PATH?: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
JWT_ISSUER?: string;
|
|
|
|
@IsNumber()
|
|
@IsOptional()
|
|
APP_PORT?: number;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
NODE_ENV?: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
CORS_ORIGINS?: string;
|
|
|
|
// Lexware Office Integration (optional)
|
|
@IsString()
|
|
@IsOptional()
|
|
LEXWARE_API_KEY?: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
LEXWARE_API_URL?: string;
|
|
|
|
// North Data Integration (optional)
|
|
@IsString()
|
|
@IsOptional()
|
|
NORTH_DATA_API_KEY?: string;
|
|
|
|
@IsString()
|
|
@IsOptional()
|
|
NORTH_DATA_API_URL?: string;
|
|
}
|
|
|
|
export function validate(
|
|
config: Record<string, unknown>,
|
|
): EnvironmentVariables {
|
|
const validatedConfig = plainToInstance(EnvironmentVariables, config, {
|
|
enableImplicitConversion: true,
|
|
});
|
|
|
|
const errors = validateSync(validatedConfig, {
|
|
skipMissingProperties: false,
|
|
});
|
|
|
|
if (errors.length > 0) {
|
|
throw new Error(
|
|
`Umgebungsvariablen-Validierung fehlgeschlagen:\n${errors.toString()}`,
|
|
);
|
|
}
|
|
|
|
return validatedConfig;
|
|
}
|