All checks were successful
Build Frontend / Build Frontend (push) Successful in 22s
- Fixed login URL from /auth/steam to /api/auth/steam - Updated all Steam login buttons to custom green design with 'Login to Steam' text - Enhanced CORS configuration with explicit preflight handling - Added Steam image proxy endpoint for CORS-free image loading - Improved environment variable management with .env.local support - Added ENV_SETUP.md guide for environment configuration
87 lines
2.4 KiB
JavaScript
87 lines
2.4 KiB
JavaScript
import dotenv from "dotenv";
|
|
import { fileURLToPath } from "url";
|
|
import { dirname, join } from "path";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
// Load .env.local first (for local development overrides), then .env
|
|
dotenv.config({ path: join(__dirname, "..", ".env.local") });
|
|
dotenv.config({ path: join(__dirname, "..", ".env") });
|
|
|
|
export const config = {
|
|
// Server
|
|
nodeEnv: process.env.NODE_ENV || "development",
|
|
port: parseInt(process.env.PORT, 10) || 3000,
|
|
host: process.env.HOST || "0.0.0.0",
|
|
|
|
// Database
|
|
mongodb: {
|
|
uri: process.env.MONGODB_URI || "mongodb://localhost:27017/turbotrades",
|
|
},
|
|
|
|
// Session
|
|
session: {
|
|
secret: process.env.SESSION_SECRET || "your-super-secret-session-key",
|
|
cookieName: "sessionId",
|
|
maxAge: 1000 * 60 * 60 * 24 * 7, // 7 days
|
|
},
|
|
|
|
// JWT
|
|
jwt: {
|
|
accessSecret: process.env.JWT_ACCESS_SECRET || "your-jwt-access-secret",
|
|
refreshSecret: process.env.JWT_REFRESH_SECRET || "your-jwt-refresh-secret",
|
|
accessExpiry: process.env.JWT_ACCESS_EXPIRY || "15m",
|
|
refreshExpiry: process.env.JWT_REFRESH_EXPIRY || "7d",
|
|
},
|
|
|
|
// Steam
|
|
steam: {
|
|
apiKey: process.env.STEAM_API_KEY,
|
|
realm: process.env.STEAM_REALM || "http://localhost:3000",
|
|
returnURL:
|
|
process.env.STEAM_RETURN_URL || "http://localhost:3000/auth/steam/return",
|
|
},
|
|
|
|
// Cookies
|
|
cookie: {
|
|
domain: process.env.COOKIE_DOMAIN || "localhost",
|
|
secure: process.env.COOKIE_SECURE === "true",
|
|
sameSite: process.env.COOKIE_SAME_SITE || "lax",
|
|
httpOnly: true,
|
|
},
|
|
|
|
// CORS
|
|
cors: {
|
|
origin: process.env.CORS_ORIGIN || "http://localhost:5173",
|
|
credentials: true,
|
|
},
|
|
|
|
// Rate Limiting
|
|
rateLimit: {
|
|
max: parseInt(process.env.RATE_LIMIT_MAX, 10) || 100,
|
|
timeWindow: parseInt(process.env.RATE_LIMIT_TIMEWINDOW, 10) || 60000,
|
|
},
|
|
|
|
// Email (for future implementation)
|
|
email: {
|
|
host: process.env.SMTP_HOST,
|
|
port: parseInt(process.env.SMTP_PORT, 10) || 587,
|
|
user: process.env.SMTP_USER,
|
|
pass: process.env.SMTP_PASS,
|
|
from: process.env.EMAIL_FROM || "noreply@turbotrades.com",
|
|
},
|
|
|
|
// WebSocket
|
|
websocket: {
|
|
pingInterval: parseInt(process.env.WS_PING_INTERVAL, 10) || 30000,
|
|
maxPayload: parseInt(process.env.WS_MAX_PAYLOAD, 10) || 1048576,
|
|
},
|
|
|
|
// Security
|
|
isDevelopment: process.env.NODE_ENV !== "production",
|
|
isProduction: process.env.NODE_ENV === "production",
|
|
};
|
|
|
|
export default config;
|