2020-10-05 12:52:01 -05:00
|
|
|
import SquadServer from 'squad-server';
|
|
|
|
import printLogo from 'squad-server/logo';
|
|
|
|
|
2020-08-20 15:21:03 -05:00
|
|
|
printLogo();
|
2020-10-21 15:00:37 -05:00
|
|
|
|
|
|
|
const config = process.env.config;
|
|
|
|
const configPath = process.argv[2];
|
|
|
|
|
2020-10-21 16:49:07 -05:00
|
|
|
if (config && configPath) throw new Error('Cannot accept both a config and config path.');
|
2020-10-21 15:00:37 -05:00
|
|
|
|
|
|
|
let server;
|
2020-10-21 16:49:07 -05:00
|
|
|
if (config) {
|
|
|
|
server = SquadServer.buildFromConfigString(config);
|
2020-10-21 15:00:37 -05:00
|
|
|
} else {
|
|
|
|
server = SquadServer.buildFromConfigFile(configPath || './config.json');
|
|
|
|
}
|
|
|
|
|
2020-10-21 16:49:07 -05:00
|
|
|
server.then((server) => server.watch());
|