diff --git a/lib/cli.js b/lib/cli.js index 41ef6af..182fa1c 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -10,15 +10,18 @@ var log = require("./logger")._system; module.exports = function() { + var insecureAccess = false; + program .version(version) .option('-P, --plugin-path [path]', 'look for plugins installed at [path] as well as the default locations ([path] can also point to a single plugin)', function(p) { Plugin.addPluginPath(p); }) .option('-U, --user-storage-path [path]', 'look for homebridge user files at [path] instead of the default location (~/.homebridge)', function(p) { User.setStoragePath(p); }) .option('-D, --debug', 'turn on debug level logging', function() { require('./logger').setDebugEnabled(true) }) + .option('-I, --insecure', 'allow insecure access to homebridge', function() { insecureAccess = true; }) .parse(process.argv); // Initialize HAP-NodeJS with a custom persist directory hap.init(User.persistPath()); - new Server().run(); + new Server(insecureAccess).run(); } diff --git a/lib/server.js b/lib/server.js index 2409366..814aa09 100644 --- a/lib/server.js +++ b/lib/server.js @@ -22,7 +22,7 @@ module.exports = { Server: Server } -function Server() { +function Server(insecureAccess) { // Setup Accessory Cache Storage accessoryStorage.initSync({ dir: User.cachedAccessoryPath() }); @@ -49,6 +49,8 @@ function Server() { this._setupManager.on('requestCurrentConfig', function(callback) { callback(this._config); }.bind(this)); + + this._allowInsecureAccess = insecureAccess || false; } Server.prototype.run = function() { @@ -83,7 +85,7 @@ Server.prototype._publish = function() { port: bridgeConfig.port || 51826, pincode: bridgeConfig.pin || "031-45-154", category: Accessory.Categories.BRIDGE - }); + }, this._allowInsecureAccess); log.info("Homebridge is running on port %s.", bridgeConfig.port || 51826); } diff --git a/package.json b/package.json index 54068bf..18c6747 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "homebridge", "description": "HomeKit support for the impatient", - "version": "0.2.16", + "version": "0.2.18", "scripts": { "dev": "DEBUG=* ./bin/homebridge -D -P example-plugins/ || true" },