stl-storage/config/config.js
kris 3dff6b00d4 Initial commit: STL Storage Application
- Complete web-based STL file storage and 3D viewer
- Express.js backend with SQLite database
- Interactive Three.js 3D viewer with orbit controls
- File upload with drag-and-drop support
- Security features: rate limiting, input validation, helmet
- Container deployment with Docker/Podman
- Production-ready configuration management
- Comprehensive logging and monitoring

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 16:18:58 +00:00

46 lines
1.5 KiB
JavaScript

require('dotenv').config();
const config = {
// Server configuration
port: parseInt(process.env.PORT) || 3000,
host: process.env.HOST || '0.0.0.0',
nodeEnv: process.env.NODE_ENV || 'development',
// Database configuration
database: {
path: process.env.DB_PATH || './stl_storage.db',
uploadDir: process.env.UPLOAD_DIR || './uploads'
},
// File upload configuration
upload: {
maxFileSize: parseInt(process.env.MAX_FILE_SIZE) || 100 * 1024 * 1024, // 100MB
maxFiles: parseInt(process.env.MAX_FILES_PER_REQUEST) || 5,
allowedExtensions: (process.env.ALLOWED_EXTENSIONS || '.stl,.STL').split(','),
destination: './uploads/stl'
},
// Security configuration
security: {
sessionSecret: process.env.SESSION_SECRET || 'change-this-secret-key',
bcryptRounds: parseInt(process.env.BCRYPT_ROUNDS) || 12,
rateLimitWindow: parseInt(process.env.RATE_LIMIT_WINDOW_MS) || 15 * 60 * 1000,
rateLimitMax: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS) || 100
},
// Logging configuration
logging: {
level: process.env.LOG_LEVEL || 'info',
file: process.env.LOG_FILE || './logs/app.log'
}
};
// Validate required configuration
const requiredEnvVars = [];
const missingVars = requiredEnvVars.filter(varName => !process.env[varName]);
if (missingVars.length > 0) {
throw new Error(`Missing required environment variables: ${missingVars.join(', ')}`);
}
module.exports = config;