inital
This commit is contained in:
69
backend/src/config/environment.ts
Normal file
69
backend/src/config/environment.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
// Load environment-specific .env file
|
||||
const envFile = process.env.NODE_ENV === 'production'
|
||||
? '.env.production'
|
||||
: '.env.development';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '../../', envFile) });
|
||||
|
||||
interface EnvironmentConfig {
|
||||
nodeEnv: string;
|
||||
port: number;
|
||||
database: {
|
||||
host: string;
|
||||
port: number;
|
||||
name: string;
|
||||
user: string;
|
||||
password: string;
|
||||
};
|
||||
jwt: {
|
||||
secret: string;
|
||||
expiresIn: string | number;
|
||||
};
|
||||
cors: {
|
||||
origin: string;
|
||||
};
|
||||
rateLimit: {
|
||||
windowMs: number;
|
||||
max: number;
|
||||
};
|
||||
authentik: {
|
||||
issuer: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
redirectUri: string;
|
||||
};
|
||||
}
|
||||
|
||||
const environment: EnvironmentConfig = {
|
||||
nodeEnv: process.env.NODE_ENV || 'development',
|
||||
port: parseInt(process.env.PORT || '3000', 10),
|
||||
database: {
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '5432', 10),
|
||||
name: process.env.DB_NAME || 'feuerwehr_dev',
|
||||
user: process.env.DB_USER || 'dev_user',
|
||||
password: process.env.DB_PASSWORD || 'dev_password',
|
||||
},
|
||||
jwt: {
|
||||
secret: process.env.JWT_SECRET || 'your-secret-key-change-in-production',
|
||||
expiresIn: process.env.JWT_EXPIRES_IN || '24h',
|
||||
},
|
||||
cors: {
|
||||
origin: process.env.CORS_ORIGIN || 'http://localhost:3001',
|
||||
},
|
||||
rateLimit: {
|
||||
windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS || '900000', 10), // 15 minutes
|
||||
max: parseInt(process.env.RATE_LIMIT_MAX || '100', 10),
|
||||
},
|
||||
authentik: {
|
||||
issuer: process.env.AUTHENTIK_ISSUER || 'https://authentik.yourdomain.com/application/o/your-app/',
|
||||
clientId: process.env.AUTHENTIK_CLIENT_ID || 'your_client_id_here',
|
||||
clientSecret: process.env.AUTHENTIK_CLIENT_SECRET || 'your_client_secret_here',
|
||||
redirectUri: process.env.AUTHENTIK_REDIRECT_URI || 'http://localhost:5173/auth/callback',
|
||||
},
|
||||
};
|
||||
|
||||
export default environment;
|
||||
Reference in New Issue
Block a user