-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·29 lines (24 loc) · 1.03 KB
/
index.js
File metadata and controls
executable file
·29 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env node
"use strict";
// ================================================================
// DXClusterAPI Launcher
// ================================================================
// This file serves as the entry point for the application.
// It determines the runtime mode and launches accordingly:
// - Native/Docker: Runs the server directly
// - Passenger: Exports the Express app for Passenger to manage
// ================================================================
// Load environment variables first
require('dotenv').config();
// Detect runtime mode
const mode = process.env.MODE || 'native';
console.log(`Starting DXClusterAPI in ${mode.toUpperCase()} mode...`);
if (mode === 'passenger') {
// For Passenger mode: require app.js (which initializes everything and exports the app)
// Then export it so Passenger can use it
const app = require('./app.js');
module.exports = app;
} else {
// For Docker and Native modes: just require app.js which starts its own server
require('./app.js');
}