const path = require('path');
const Logger = require('./core/Logger.js');
const Settings = require('./core/Settings.js');
const Data = require('./core/Data.js');
const SocketServer = require('./core/SocketServer.js');
const StaticServer = require('./core/StaticServer.js');
/**
* @class jtree
* Entrypoint of the server. Maintains links between different processes, allowing for interaction.
* If requested, opens the admin interface in the browser.
*/
var jt = {};
// The version of jtree, should match what is in buildJTree.bat
jt.version = '0.8.6';
/** Location of the server executable. All files should be relative to this.
*/
jt.path = undefined;
if (process.argv[0].indexOf('node') > -1) {
jt.path = process.cwd();
} else {
jt.path = path.dirname(process.execPath);
}
/**
* The settings
* @type {Settings}
*/
jt.settings = new Settings.new(jt);
/**
* The utility for writting logs.
* @type {Logger}
*/
jt.logger = new Logger.new(jt);
/**
* The Data object
* @type {Data}
*/
jt.data = new Data.new(jt);
/**
* The process that serves static files to clients.
* @type {StaticServer}
*/
jt.staticServer = new StaticServer.new(jt);
/**
* The process that receives and sends messages to clients.
* @type {SocketServer}
*/
jt.socketServer = new SocketServer.new(jt);