initial commit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-03-23 08:46:51 +01:00
commit 4608494a3f
130 changed files with 40361 additions and 0 deletions

51
src/config/env.ts Normal file
View File

@@ -0,0 +1,51 @@
import dotenv from 'dotenv';
dotenv.config();
function required(key: string): string {
const val = process.env[key];
if (!val) throw new Error(`Missing required env variable: ${key}`);
return val;
}
export const config = {
port: parseInt(process.env.PORT || '3001', 10),
host: process.env.HOST || '127.0.0.1',
appEnv: process.env.APP_ENV || 'local',
isProduction: process.env.APP_ENV === 'production',
db: {
url: required('DATABASE_URL'),
},
jwt: {
secret: required('JWT_SECRET'),
accessTokenExpiry: parseInt(process.env.ACCESS_TOKEN_EXPIRY || '900', 10),
refreshTokenSessionExpiry: parseInt(process.env.REFRESH_TOKEN_SESSION_EXPIRY || '3600', 10),
refreshTokenRememberExpiry: parseInt(process.env.REFRESH_TOKEN_REMEMBER_EXPIRY || '2592000', 10),
},
totp: {
encryptionKey: required('TOTP_ENCRYPTION_KEY'),
},
nas: {
path: process.env.NAS_PATH || 'Z:/02_PROJEKTY',
maxUploadSize: parseInt(process.env.MAX_UPLOAD_SIZE || '52428800', 10),
},
email: {
contactTo: process.env.CONTACT_EMAIL_TO || '',
contactFrom: process.env.CONTACT_EMAIL_FROM || '',
smtpFrom: process.env.SMTP_FROM || '',
},
cors: {
origins: (process.env.CORS_ORIGINS || '').split(',').filter(Boolean),
},
security: {
maxLoginAttempts: 5,
lockoutMinutes: 15,
bcryptCost: 12,
},
} as const;