Skip to content

Commit 11122d3

Browse files
committed
Use es6 notation in clientonly
1 parent 2dea939 commit 11122d3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clientonly/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Use separate scope to prevent global scope pollution
44
(function () {
5-
var config = {};
5+
const config = {};
66

77
/**
88
* Helper function to get server address/hostname from either the commandline or env
@@ -17,8 +17,8 @@
1717
* @returns {string} the value of the parameter
1818
*/
1919
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;
2222
return value !== undefined ? String(value) : defaultValue;
2323
}
2424

@@ -43,7 +43,7 @@
4343
// Select http or https module, depending on requested url
4444
const lib = url.startsWith("https") ? require("https") : require("http");
4545
const request = lib.get(url, (response) => {
46-
var configData = "";
46+
let configData = "";
4747

4848
// Gather incoming data
4949
response.on("data", function (chunk) {
@@ -79,15 +79,15 @@
7979
getServerAddress();
8080

8181
(config.address && config.port) || fail();
82-
var prefix = config.tls ? "https://" : "http://";
82+
const prefix = config.tls ? "https://" : "http://";
8383

8484
// Only start the client if a non-local server was provided
8585
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
8686
getServerConfig(`${prefix}${config.address}:${config.port}/config/`)
8787
.then(function (configReturn) {
8888
// 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 };
9191
configReturn.address = config.address;
9292
configReturn.port = config.port;
9393
configReturn.tls = config.tls;

0 commit comments

Comments
 (0)