From 11122d3f810954da94261976f303cbf8f2c3d095 Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 18 Apr 2021 15:36:00 +0200 Subject: [PATCH] Use es6 notation in clientonly --- clientonly/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clientonly/index.js b/clientonly/index.js index 3564eef892..1a0a797009 100644 --- a/clientonly/index.js +++ b/clientonly/index.js @@ -2,7 +2,7 @@ // Use separate scope to prevent global scope pollution (function () { - var config = {}; + const config = {}; /** * Helper function to get server address/hostname from either the commandline or env @@ -17,8 +17,8 @@ * @returns {string} the value of the parameter */ function getCommandLineParameter(key, defaultValue = undefined) { - var index = process.argv.indexOf(`--${key}`); - var value = index > -1 ? process.argv[index + 1] : undefined; + const index = process.argv.indexOf(`--${key}`); + const value = index > -1 ? process.argv[index + 1] : undefined; return value !== undefined ? String(value) : defaultValue; } @@ -43,7 +43,7 @@ // Select http or https module, depending on requested url const lib = url.startsWith("https") ? require("https") : require("http"); const request = lib.get(url, (response) => { - var configData = ""; + let configData = ""; // Gather incoming data response.on("data", function (chunk) { @@ -79,15 +79,15 @@ getServerAddress(); (config.address && config.port) || fail(); - var prefix = config.tls ? "https://" : "http://"; + const prefix = config.tls ? "https://" : "http://"; // Only start the client if a non-local server was provided if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) { getServerConfig(`${prefix}${config.address}:${config.port}/config/`) .then(function (configReturn) { // Pass along the server config via an environment variable - var env = Object.create(process.env); - var options = { env: env }; + const env = Object.create(process.env); + const options = { env: env }; configReturn.address = config.address; configReturn.port = config.port; configReturn.tls = config.tls;