SquadJS/index.js

19 lines
470 B
JavaScript
Raw Normal View History

2020-10-05 12:52:01 -05:00
import SquadServer from 'squad-server';
import printLogo from 'squad-server/logo';
printLogo();
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.');
let server;
2020-10-21 16:49:07 -05:00
if (config) {
server = SquadServer.buildFromConfigString(config);
} else {
server = SquadServer.buildFromConfigFile(configPath || './config.json');
}
2020-10-21 16:49:07 -05:00
server.then((server) => server.watch());