From e6b5bc31a130b40f8e20eafa70a3d5c6dea2cb6c Mon Sep 17 00:00:00 2001 From: Sven-Ove Bjerkan Date: Fri, 4 Aug 2017 12:33:01 +0200 Subject: [PATCH 1/3] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d67c5d9..72110ec 100755 --- a/README.md +++ b/README.md @@ -53,6 +53,13 @@ allowed host and options values. ## Running It Get up and running immediately with `script/server`. +#### Note: +On some distros, you might get an error when running it: +`/usr/bin/node: No such file or directory` + +That can probably be fixed by creating a symlink: +``sudo ln -s `which nodejs` /usr/bin/node`` + Harmony API will run on port `8282` by default. Use the `PORT` environment variable to use your own port. From b25af87e23dd3db277df0883d0f5982e1bd44d8a Mon Sep 17 00:00:00 2001 From: Sven-Ove Bjerkan Date: Fri, 4 Aug 2017 14:04:50 +0200 Subject: [PATCH 2/3] Option of disabling HTTP-server For those only interested in MQTT. --- app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index cc1fc80..fcdc9c2 100755 --- a/app.js +++ b/app.js @@ -31,6 +31,9 @@ var mqttClient = config.hasOwnProperty("mqtt_options") ? mqtt.connect(config.mqtt_host); var TOPIC_NAMESPACE = config.topic_namespace || "harmony-api"; +var enableHTTPserver = config.hasOwnProperty("enableHTTPserver") ? + config.enableHTTPserver : true; + var app = express() app.use(bodyParser.urlencoded({ extended: false })) app.use(express.static(path.join(__dirname, 'public'))); @@ -560,4 +563,6 @@ app.get('/hubs_for_index', function(req, res){ res.send(output) }) -app.listen(process.env.PORT || 8282) +if (enableHTTPserver) { + app.listen(process.env.PORT || 8282) +} From 0ae7c4b7d4b0efade9190600fcfa38712aaf2c5c Mon Sep 17 00:00:00 2001 From: Sven-Ove Bjerkan Date: Fri, 4 Aug 2017 14:07:48 +0200 Subject: [PATCH 3/3] Added more of the optional parameters --- config/config.sample.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.sample.json b/config/config.sample.json index 241454b..e6ea469 100644 --- a/config/config.sample.json +++ b/config/config.sample.json @@ -1,5 +1,7 @@ { + "enableHTTPserver": true, "mqtt_host": "mqtt://127.0.0.1", + "topic_namespace": "harmony-api", "mqtt_options": { "port": 1883, "username": "someuser",