|
2 | 2 | Object.defineProperty(exports, "__esModule", { value: true }); |
3 | 3 | const path_1 = require("path"); |
4 | 4 | const ssl = { |
5 | | - key: getParam( |
6 | | - "key", |
7 | | - (0, path_1.resolve)(__dirname, "..", "ssl", "example.key") |
8 | | - ), |
9 | | - cert: getParam( |
10 | | - "cert", |
11 | | - (0, path_1.resolve)(__dirname, "..", "ssl", "example.crt") |
12 | | - ), |
| 5 | + key: getParam("key", (0, path_1.resolve)(__dirname, "..", "ssl", "example.key")), |
| 6 | + cert: getParam("cert", (0, path_1.resolve)(__dirname, "..", "ssl", "example.crt")), |
13 | 7 | }; |
14 | 8 | const config = { |
15 | | - // this enables http/ws logs |
16 | | - debug: process.argv.includes("--debug"), |
17 | | - // port on which the server listens |
18 | | - port: Number(process.env.PORT || 4200), |
19 | | - // you can use --plugin ./path/to/plugin.js any number of times |
20 | | - plugins: {}, |
21 | | - // handshake event |
22 | | - join: "/join", |
23 | | - // disconnect from room event |
24 | | - leave: "/leave", |
25 | | - // folder to static serve files |
26 | | - folder: process.argv[2], |
27 | | - // type of server to start |
28 | | - type: process.argv.includes("--uws") ? "uws" : "express", |
29 | | - // ssl = undefined | { key, cert } |
30 | | - ssl: process.argv.includes("--ssl") ? ssl : undefined, |
31 | | - // max cache size prevents oom |
32 | | - maxCacheSize: 128, |
| 9 | + // this enables http/ws logs |
| 10 | + debug: process.argv.includes("--debug"), |
| 11 | + // port on which the server listens |
| 12 | + port: Number(process.env.PORT || 4200), |
| 13 | + // you can use --plugin ./path/to/plugin.js any number of times |
| 14 | + plugins: {}, |
| 15 | + // handshake event |
| 16 | + join: "/join", |
| 17 | + // disconnect from room event |
| 18 | + leave: "/leave", |
| 19 | + // folder to static serve files |
| 20 | + folder: process.argv[2], |
| 21 | + // type of server to start |
| 22 | + type: process.argv.includes("--uws") ? "uws" : "express", |
| 23 | + // ssl = undefined | { key, cert } |
| 24 | + ssl: process.argv.includes("--ssl") ? ssl : undefined, |
| 25 | + // max cache size prevents oom |
| 26 | + maxCacheSize: 128, |
33 | 27 | }; |
34 | 28 | function getParam(find, fallback) { |
35 | | - const matches = process.argv.join(" ").match(new RegExp(`--${find} ([^ ]+)`)); |
36 | | - return matches ? matches[1] : fallback; |
| 29 | + const matches = process.argv |
| 30 | + .join(" ") |
| 31 | + .match(new RegExp(`--${find} ([^ ]+)`)); |
| 32 | + return matches ? matches[1] : fallback; |
37 | 33 | } |
38 | 34 | exports.default = config; |
0 commit comments