- Create src/config/paths.js for all file paths and env vars - Create src/config/site.js for site configuration loading - Create src/config/index.js as unified config export - Prepare for server.js modularization (Phase 2.1) Part of deslopification roadmap: break 1997-line server.js into layers
39 lines
860 B
JavaScript
39 lines
860 B
JavaScript
/**
|
|
* Centralized configuration module
|
|
* Exports all configuration loading and path resolution
|
|
*/
|
|
const paths = require('./paths');
|
|
const site = require('./site');
|
|
const { APP, LIMITS, TIMEOUTS, RETRIES, CADDY } = require('../../constants');
|
|
|
|
// Load logging level
|
|
const LOG_LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
const LOG_LEVEL = LOG_LEVELS[process.env.LOG_LEVEL || 'info'] || 1;
|
|
|
|
const PORT = APP.PORT;
|
|
const MAX_ERROR_LOG_SIZE = LIMITS.ERROR_LOG_SIZE;
|
|
|
|
module.exports = {
|
|
// Paths
|
|
...paths,
|
|
|
|
// Site configuration
|
|
siteConfig: site.siteConfig,
|
|
loadSiteConfig: site.loadSiteConfig,
|
|
buildDomain: site.buildDomain,
|
|
buildServiceUrl: site.buildServiceUrl,
|
|
|
|
// App constants
|
|
PORT,
|
|
LOG_LEVELS,
|
|
LOG_LEVEL,
|
|
MAX_ERROR_LOG_SIZE,
|
|
|
|
// Re-export constants for convenience
|
|
APP,
|
|
LIMITS,
|
|
TIMEOUTS,
|
|
RETRIES,
|
|
CADDY,
|
|
};
|