mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Merge branch 'master' into plugin-2
This commit is contained in:
16
lib/cli.js
16
lib/cli.js
@@ -17,11 +17,23 @@ module.exports = function() {
|
||||
.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; })
|
||||
.option('-I, --insecure', 'allow unauthenticated requests (for easier hacking)', function() { insecureAccess = true })
|
||||
.parse(process.argv);
|
||||
|
||||
// Initialize HAP-NodeJS with a custom persist directory
|
||||
hap.init(User.persistPath());
|
||||
|
||||
new Server(insecureAccess).run();
|
||||
var server = new Server(insecureAccess);
|
||||
|
||||
var signals = { 'SIGINT': 2, 'SIGTERM': 15 };
|
||||
Object.keys(signals).forEach(function (signal) {
|
||||
process.on(signal, function () {
|
||||
log.info("Got %s, shutting down Homebridge...", signal);
|
||||
|
||||
// FIXME: Shut down server cleanly
|
||||
process.exit(128 + signals[signal]);
|
||||
});
|
||||
});
|
||||
|
||||
server.run();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,11 @@ function Server(insecureAccess) {
|
||||
callback(this._config);
|
||||
}.bind(this));
|
||||
|
||||
// Server is "secure by default", meaning it creates a top-level Bridge accessory that
|
||||
// will not allow unauthenticated requests. This matches the behavior of actual HomeKit
|
||||
// accessories. However you can set this to true to allow all requests without authentication,
|
||||
// which can be useful for easy hacking. Note that this will expose all functions of your
|
||||
// bridged accessories, like changing charactersitics (i.e. flipping your lights on and off).
|
||||
this._allowInsecureAccess = insecureAccess || false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user