|
2 | 2 |
|
3 | 3 | // Use separate scope to prevent global scope pollution
|
4 | 4 | (function () {
|
5 |
| - var config = {}; |
| 5 | + const config = {}; |
6 | 6 |
|
7 | 7 | /**
|
8 | 8 | * Helper function to get server address/hostname from either the commandline or env
|
|
17 | 17 | * @returns {string} the value of the parameter
|
18 | 18 | */
|
19 | 19 | function getCommandLineParameter(key, defaultValue = undefined) {
|
20 |
| - var index = process.argv.indexOf(`--${key}`); |
21 |
| - var value = index > -1 ? process.argv[index + 1] : undefined; |
| 20 | + const index = process.argv.indexOf(`--${key}`); |
| 21 | + const value = index > -1 ? process.argv[index + 1] : undefined; |
22 | 22 | return value !== undefined ? String(value) : defaultValue;
|
23 | 23 | }
|
24 | 24 |
|
|
43 | 43 | // Select http or https module, depending on requested url
|
44 | 44 | const lib = url.startsWith("https") ? require("https") : require("http");
|
45 | 45 | const request = lib.get(url, (response) => {
|
46 |
| - var configData = ""; |
| 46 | + let configData = ""; |
47 | 47 |
|
48 | 48 | // Gather incoming data
|
49 | 49 | response.on("data", function (chunk) {
|
|
79 | 79 | getServerAddress();
|
80 | 80 |
|
81 | 81 | (config.address && config.port) || fail();
|
82 |
| - var prefix = config.tls ? "https://" : "http://"; |
| 82 | + const prefix = config.tls ? "https://" : "http://"; |
83 | 83 |
|
84 | 84 | // Only start the client if a non-local server was provided
|
85 | 85 | if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
|
86 | 86 | getServerConfig(`${prefix}${config.address}:${config.port}/config/`)
|
87 | 87 | .then(function (configReturn) {
|
88 | 88 | // Pass along the server config via an environment variable
|
89 |
| - var env = Object.create(process.env); |
90 |
| - var options = { env: env }; |
| 89 | + const env = Object.create(process.env); |
| 90 | + const options = { env: env }; |
91 | 91 | configReturn.address = config.address;
|
92 | 92 | configReturn.port = config.port;
|
93 | 93 | configReturn.tls = config.tls;
|
|
0 commit comments