From be5dcea247477368fabe633ba30a4aea103751f3 Mon Sep 17 00:00:00 2001 From: Samuel Dillow Date: Tue, 20 Sep 2022 16:25:45 -0500 Subject: [PATCH 1/2] Allow hostname to be passed in Some of our nodes have hostnames determined at runtime and cannot be placed in the .env. We also can't update process.env.DISCOVERY_HOSTNAME, because the variable is captured [on import](https://github.com/dashersw/node-discover/blob/master/lib/network.js#L11) instead of on instantiation. This small change allows the hostname to be determined by the consumer of the library. --- lib/discover.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/discover.js b/lib/discover.js index 6717f7d..2d7f461 100644 --- a/lib/discover.js +++ b/lib/discover.js @@ -121,7 +121,8 @@ function Discover (options, callback) { reuseAddr : settings.reuseAddr, ignoreProcess : settings.ignoreProcess, ignoreInstance : settings.ignoreInstance, - redis : settings.redis + redis : settings.redis, + hostname: options.hostname, }); //This is the object that gets broadcast with each hello packet. From f4ddc26b29423723465dddc6482bf4f8579150dd Mon Sep 17 00:00:00 2001 From: Samuel Dillow Date: Tue, 20 Sep 2022 16:27:04 -0500 Subject: [PATCH 2/2] Tidy up formatting --- lib/discover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/discover.js b/lib/discover.js index 2d7f461..bf98c8c 100644 --- a/lib/discover.js +++ b/lib/discover.js @@ -122,7 +122,7 @@ function Discover (options, callback) { ignoreProcess : settings.ignoreProcess, ignoreInstance : settings.ignoreInstance, redis : settings.redis, - hostname: options.hostname, + hostname : options.hostname, }); //This is the object that gets broadcast with each hello packet.