mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:57:08 +00:00
31 lines
871 B
JavaScript
Executable File
31 lines
871 B
JavaScript
Executable File
#!/usr/bin/node
|
|
|
|
async function main () {
|
|
// Check that we're running against the correct database version
|
|
const version = require('./lib/version');
|
|
console.log("Running version", await version.describe());
|
|
version.compatible()
|
|
.then( (versions) => {
|
|
const api = require('./api');
|
|
const ws = require('./ws');
|
|
|
|
const { fork } = require('child_process');
|
|
|
|
const server = api.start(process.env.HTTP_PORT || 3000, process.env.HTTP_PATH);
|
|
ws.start(server);
|
|
|
|
const eventManagerPath = [__dirname, "events"].join("/");
|
|
const eventManager = fork(eventManagerPath, /*{ stdio: 'ignore' }*/);
|
|
|
|
console.info("Versions", versions);
|
|
|
|
process.on('exit', () => eventManager.kill());
|
|
})
|
|
.catch( ({current, wanted, component}) => {
|
|
console.error(`Fatal error: incompatible ${component} version ${current} (wanted: ${wanted})`);
|
|
process.exit(1);
|
|
});
|
|
}
|
|
|
|
main();
|