u
This commit is contained in:
@@ -5,8 +5,18 @@ import { fileURLToPath } from 'url';
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
dotenv.config({ path: resolve(__dirname, '../../.env'), quiet: true });
|
||||
|
||||
function parseHttpsPort(val) {
|
||||
if (val === undefined || val === '') return 8443;
|
||||
if (val === 'false' || val === '0' || val === 'none' || val === 'disabled') return null;
|
||||
const n = Number(val);
|
||||
return Number.isInteger(n) && n > 0 ? n : 8443;
|
||||
}
|
||||
|
||||
export default {
|
||||
port: Number(process.env.PORT) || 4208,
|
||||
httpsPort: parseHttpsPort(process.env.HTTPS_PORT),
|
||||
httpsKeyPath: process.env.HTTPS_KEY_PATH || resolve(__dirname, '../../certs/key.pem'),
|
||||
httpsCertPath: process.env.HTTPS_CERT_PATH || resolve(__dirname, '../../certs/cert.pem'),
|
||||
bodyLimit: process.env.BODY_LIMIT || '100mb',
|
||||
corsOrigins: (process.env.CORS_ORIGINS || 'http://localhost:5173')
|
||||
.split(',')
|
||||
|
||||
Reference in New Issue
Block a user