forked from Team-Silver-Sphere/SquadJS
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (17 loc) · 684 Bytes
/
index.js
File metadata and controls
23 lines (17 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import SquadServerFactory from 'squad-server/factory';
import printLogo from 'squad-server/logo';
async function main() {
await printLogo();
const config = process.env.config;
const configPath = process.argv[2];
if (config && configPath) throw new Error('Cannot accept both a config and config path.');
// create a SquadServer instance
const server = config
? await SquadServerFactory.buildFromConfigString(config)
: await SquadServerFactory.buildFromConfigFile(configPath || './config.json');
// watch the server
await server.watch();
// now mount the plugins
await Promise.all(server.plugins.map(async (plugin) => await plugin.mount()));
}
main();