2019-04-16 05:16:57 +00:00
|
|
|
/* eslint-disable global-require */
|
|
|
|
/* eslint-disable no-console */
|
2019-02-13 05:36:29 +00:00
|
|
|
const ShareXAPI = require(`${__dirname}/server/app`);
|
2019-04-15 17:37:19 +00:00
|
|
|
/** Setting definitions for the config file and server class */
|
2019-04-16 05:16:57 +00:00
|
|
|
let c;
|
|
|
|
let server;
|
2019-04-04 05:25:00 +00:00
|
|
|
console.log(`\x1b[31m
|
|
|
|
======================================================================
|
|
|
|
|\x1b[0m\x1b[34m ________ ___ ___ ________ ________ _______ ________ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m |\\ ____\\|\\ \\|\\ \\|\\ __ \\|\\ __ \\|\\ ___ \\ |\\ ____\\ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m \\ \\ \\___|\\ \\ \\\\\\ \\ \\ \\|\\ \\ \\ \\|\\ \\ \\ __/|\\ \\ \\___|_ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m \\ \\_____ \\ \\ __ \\ \\ __ \\ \\ _ _\\ \\ \\_|/_\\ \\_____ \\ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m \\|____|\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\\\ \\\\ \\ \\_|\\ \\|____|\\ \\ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m ____\\_\\ \\ \\__\\ \\__\\ \\__\\ \\__\\ \\__\\\\ _\\\\ \\_______\\____\\_\\ \\ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m |\\_________\\|__|\\|__|\\|__|\\|__|\\|__|\\|__|\\|_______|\\_________\\ \x1b[0m\x1b[31m|
|
|
|
|
|\x1b[0m\x1b[34m \\|_________| \\|_________| \x1b[0m\x1b[31m|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
======================================================================
|
|
|
|
|\x1b[0m\x1b[32m Creator: github.com/TannerReynolds\x1b[0m\x1b[31m |
|
2021-09-17 20:28:13 +00:00
|
|
|
|\x1b[0m\x1b[32m Guilded Server: https://www.guilded.gg/Tanners-Space?i=4WPKkDPd\x1b[0m\x1b[31m |
|
2019-04-16 05:16:57 +00:00
|
|
|
======================================================================\x1b[0m`);
|
2019-04-15 17:37:19 +00:00
|
|
|
|
2019-04-16 05:16:57 +00:00
|
|
|
/** Determines whether or not to use the test config or not.
|
|
|
|
* Test env config does not get pushed to git
|
2019-04-15 19:39:39 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2019-03-04 07:52:49 +00:00
|
|
|
async function loadConfig() {
|
2019-04-16 05:16:57 +00:00
|
|
|
process.argv[2] === '-test'
|
|
|
|
? c = require(`${__dirname}/config.real.json`)
|
|
|
|
: c = require(`${__dirname}/config.json`);
|
2019-03-04 07:52:49 +00:00
|
|
|
}
|
2019-04-16 05:16:57 +00:00
|
|
|
|
|
|
|
loadConfig().then(() => {
|
|
|
|
/** Starting server using the selected config file */
|
|
|
|
server = new ShareXAPI(c);
|
|
|
|
});
|
|
|
|
process.on('SIGINT', async () => {
|
|
|
|
server.log.warning('Gracefully exiting..');
|
|
|
|
process.exit();
|
|
|
|
});
|
|
|
|
|
|
|
|
process.on('unhandledRejection', async err => server.log.uncaughtError(err.stack));
|
|
|
|
process.on('uncaughtException', async err => server.log.uncaughtError(err.stack));
|