diff options
author | Minteck <minteck@phoenixnet.tech> | 2021-10-17 20:08:04 +0200 |
---|---|---|
committer | Minteck <minteck@phoenixnet.tech> | 2021-10-17 20:08:04 +0200 |
commit | 3a94acf27ea1eff8bd1125450f07c0c366332e80 (patch) | |
tree | 5bd619df0b7e04afc174df98736a527477522acb /server/core.js | |
download | rainbow-3a94acf27ea1eff8bd1125450f07c0c366332e80.tar.gz rainbow-3a94acf27ea1eff8bd1125450f07c0c366332e80.tar.bz2 rainbow-3a94acf27ea1eff8bd1125450f07c0c366332e80.zip |
Initial commit
Diffstat (limited to 'server/core.js')
-rw-r--r-- | server/core.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/server/core.js b/server/core.js new file mode 100644 index 0000000..c166e3a --- /dev/null +++ b/server/core.js @@ -0,0 +1,32 @@ +global.mpws = require('./version'); + +global.log = require('./log') +global.fs = require('fs') +log.info("Reading configuration...") +global.config = require('../global/config.json') +log.info("Checking configuration integrity...") +log.verbose("Checking 'port'") +if (isNaN(config.port)) { + log.error("'port' is invalid") +} +log.verbose("Checking 'document_root'") +if (typeof config.document_root == 'string') { + log.info("Loading storage module...") + if (config.document_root.startsWith(".")) { + global.wwwdata = __dirname + "/../" + config.document_root + global.private = __dirname + "/../" + config.document_root + "/../private"; + } else { + global.wwwdata = config.document_root + global.private = config.document_root + "/../private"; + } + if (fs.existsSync(wwwdata)) { + log.info("Will start Satellite at " + wwwdata) + log.info("Checking for port availability...") + log.verbose("Running server/check.js/check") + require('./check.js').check() + } else { + log.error("'document_root' cannot be found") + } +} else { + log.error("'document_root' is invalid") +}
\ No newline at end of file |