From fb670db17c6b880a26ec32b96f77669f7b97e2e3 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Fri, 21 Nov 2014 18:14:18 -0800 Subject: [PATCH] make HFTSite able to change options after initialziation --- server/hftsite.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/server/hftsite.js b/server/hftsite.js index b5a3e858..4ed2ea02 100644 --- a/server/hftsite.js +++ b/server/hftsite.js @@ -56,10 +56,25 @@ var inform = function() { } }; +/** + * @typedef {Object} HFTSite~Options + * @property {string?} address ip address eg. "1.2.3.4" + * @property {string?} port port eg "18679" + * @property {boolean?} privateServer true = don't send info to hftsite + */ + +/** + * Set options for hftSize + * + * @param {HFTSite~Options} options + */ var setup = function(options) { - g.address = options.address; - g.port = options.port; - g.privateServer = options.privateServer; + ["address", "port", "privateServer"].forEach(function(key) { + var value = options[key]; + if (value !== undefined) { + g[key] = value; + } + }); }; exports.inform = inform;