Files
DRB-Client/client.js

34 lines
1.1 KiB
JavaScript

import { ClientNodeConfig } from './modules/clientObjectDefinitions.mjs';
import { initSocketConnection } from './modules/socketClient.mjs';
import { checkForUpdates } from './modules/selfUpdater.mjs'
import startServer from './express/server.mjs';
import dotenv from 'dotenv';
dotenv.config()
var localNodeConfig = new ClientNodeConfig({})
async function boot() {
// Check if there have been any updates
await checkForUpdates();
if (localNodeConfig.node.nuid === undefined || localNodeConfig.node.nuid === '' || localNodeConfig.node.nuid === '0' || localNodeConfig.node.nuid === 0) {
return new Promise(res => {res(false)});
}
// Initialize the socket connection with the server
return initSocketConnection(localNodeConfig);
}
// Boot the client application
boot().then((openSocket) => {
// Start the web server
startServer(process.env.WEB_SERVER_PORT || 3000, openSocket);
if (!openSocket) {
console.log(openSocket, "Waiting for setup");
}
else {
console.log(openSocket, "Booted Sucessfully");
}
})