Skip to content

Commit

Permalink
Use es6 notation in clientonly
Browse files Browse the repository at this point in the history
  • Loading branch information
rejas committed Apr 18, 2021
1 parent 2dea939 commit 11122d3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions clientonly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 11122d3

Please sign in to comment.