mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 06:59:09 +00:00
fix: cleanup merge
This commit is contained in:
@@ -163,95 +163,3 @@ export const startServer = async (overrideConfig = null) => {
|
|||||||
|
|
||||||
return returnMessage;
|
return returnMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************** START SERVICES ***************/
|
|
||||||
/* Override config
|
|
||||||
* ----------------
|
|
||||||
*
|
|
||||||
* Configuration of services comes from app general config
|
|
||||||
* It can be overriden here by the settings in the db
|
|
||||||
* It can also be overriden on call
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const s = data.settings;
|
|
||||||
|
|
||||||
const oscIP = s.oscOutIP || config.osc.ipOut;
|
|
||||||
const oscOutPort = s.oscOutPort || config.osc.portOut;
|
|
||||||
const oscInPort = s.oscInPort || config.osc.port;
|
|
||||||
|
|
||||||
const serverPort = s.serverPort || config.server.port;
|
|
||||||
|
|
||||||
// Start OSC server
|
|
||||||
import { initiateOSC, shutdownOSCServer } from './controllers/OscController.js';
|
|
||||||
|
|
||||||
export const startOSCServer = async (overrideConfig = null) => {
|
|
||||||
// Setup default port
|
|
||||||
const oscSettings = {
|
|
||||||
port: overrideConfig?.port || oscInPort,
|
|
||||||
ipOut: oscIP,
|
|
||||||
portOut: oscOutPort,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start OSC Server
|
|
||||||
initiateOSC(oscSettings);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start OSC Client
|
|
||||||
let oscClient = null;
|
|
||||||
|
|
||||||
export const startOSCClient = async (overrideConfig = null) => {
|
|
||||||
// Setup default port
|
|
||||||
const port = overrideConfig?.port || oscOutPort;
|
|
||||||
console.log('initialise OSC Client on port: ', port);
|
|
||||||
|
|
||||||
oscClient = new Client(oscIP, oscOutPort);
|
|
||||||
};
|
|
||||||
|
|
||||||
// create HTTP server
|
|
||||||
const server = http.createServer(app);
|
|
||||||
|
|
||||||
export const startServer = async (overrideConfig = null) => {
|
|
||||||
// Setup default port
|
|
||||||
// const port = overrideConfig?.port || serverPort;
|
|
||||||
|
|
||||||
/* Note: Port is hardcoded
|
|
||||||
* need to find a good solution for sharing
|
|
||||||
* the dynamic info with the frontend
|
|
||||||
*/
|
|
||||||
const port = 4001;
|
|
||||||
|
|
||||||
// Start server
|
|
||||||
const returnMessage = `HTTP Server is listening on port ${port}`;
|
|
||||||
server.listen(port, '0.0.0.0', () => console.log(returnMessage));
|
|
||||||
|
|
||||||
// init timer
|
|
||||||
global.timer = new EventTimer(server, oscClient, config);
|
|
||||||
global.timer.setupWithEventList(data.events);
|
|
||||||
|
|
||||||
return returnMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const shutdown = async () => {
|
|
||||||
console.log('Node service shutdown');
|
|
||||||
|
|
||||||
user.event('NODE', 'shutdown', 'requesting node shutfown').send();
|
|
||||||
|
|
||||||
// shutdown express server
|
|
||||||
server.close();
|
|
||||||
|
|
||||||
// shutdown OSC Server
|
|
||||||
shutdownOSCServer();
|
|
||||||
|
|
||||||
// shutdown OSC Client
|
|
||||||
oscClient.close();
|
|
||||||
|
|
||||||
// shutdown timer
|
|
||||||
global.timer.shutdown();
|
|
||||||
};
|
|
||||||
|
|
||||||
// if (env == 'development') {
|
|
||||||
// startServer();
|
|
||||||
// startOSCServer();
|
|
||||||
// startOSCClient();
|
|
||||||
// }
|
|
||||||
|
|||||||
Reference in New Issue
Block a user