Initial commit: MinIO WebUI - Complete implementation
- Backend: Express.js API with MinIO CLI integration - Frontend: React with Material-UI for non-technical users - Features: Bucket management, user creation, storage monitoring - Security: JWT auth, IP filtering, encrypted passwords - Docker support for easy deployment - Automated weekly storage reports - Setup and deployment scripts included
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
const dotenv = require('dotenv');
|
||||
const path = require('path');
|
||||
|
||||
// Load environment variables
|
||||
dotenv.config({ path: path.join(__dirname, '../../../.env') });
|
||||
|
||||
const config = {
|
||||
app: {
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
port: parseInt(process.env.PORT || '3000', 10),
|
||||
logLevel: process.env.LOG_LEVEL || 'info',
|
||||
},
|
||||
auth: {
|
||||
adminPasswordHash: process.env.ADMIN_PASSWORD_HASH,
|
||||
jwtSecret: process.env.JWT_SECRET,
|
||||
sessionTimeout: parseInt(process.env.SESSION_TIMEOUT || '1800', 10),
|
||||
},
|
||||
security: {
|
||||
enableIpRestriction: process.env.ENABLE_IP_RESTRICTION === 'true',
|
||||
allowedIps: process.env.ALLOWED_IPS ? process.env.ALLOWED_IPS.split(',').map(ip => ip.trim()) : [],
|
||||
},
|
||||
minio: {
|
||||
defaultAlias: process.env.DEFAULT_MINIO_ALIAS || 'minio',
|
||||
endpoint: process.env.MINIO_ENDPOINT,
|
||||
accessKey: process.env.MINIO_ACCESS_KEY,
|
||||
secretKey: process.env.MINIO_SECRET_KEY,
|
||||
},
|
||||
email: {
|
||||
host: process.env.SMTP_HOST,
|
||||
port: parseInt(process.env.SMTP_PORT || '587', 10),
|
||||
secure: process.env.SMTP_SECURE === 'true',
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASS,
|
||||
},
|
||||
from: process.env.REPORT_SENDER,
|
||||
to: process.env.REPORT_RECIPIENT,
|
||||
},
|
||||
reports: {
|
||||
schedule: process.env.REPORT_SCHEDULE || '0 0 * * 1',
|
||||
},
|
||||
redis: {
|
||||
host: process.env.REDIS_HOST || 'localhost',
|
||||
port: parseInt(process.env.REDIS_PORT || '6379', 10),
|
||||
password: process.env.REDIS_PASSWORD,
|
||||
},
|
||||
};
|
||||
|
||||
// Validate required configuration
|
||||
const validateConfig = () => {
|
||||
const required = [
|
||||
'auth.adminPasswordHash',
|
||||
'auth.jwtSecret',
|
||||
'minio.defaultAlias',
|
||||
];
|
||||
|
||||
const missing = [];
|
||||
required.forEach(key => {
|
||||
const keys = key.split('.');
|
||||
let value = config;
|
||||
keys.forEach(k => {
|
||||
value = value[k];
|
||||
});
|
||||
if (!value) {
|
||||
missing.push(key);
|
||||
}
|
||||
});
|
||||
|
||||
if (missing.length > 0) {
|
||||
throw new Error(`Missing required configuration: ${missing.join(', ')}`);
|
||||
}
|
||||
};
|
||||
|
||||
// Only validate in production
|
||||
if (config.app.env === 'production') {
|
||||
validateConfig();
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user