boss-remote
v1.1.2
Published
Starts or connects to the boss daemon
Downloads
22
Readme
boss-remote
A remote interface to boss.
Usage
Remote boss instance (not implemented yet). The only difference here is we pass an extra argument to boss.connect
and for obvious reasons the server will not be started if it cannot be reached.
var remote = require('boss-remote'),
config = {
boss: {
timeout: 10000
}
},
opts = {
url: 'https://my.server:1234',
key: '/path/to/private/key'
}
remote(config, opts, function(error, boss) {
// we are now connected to remote boss instance
boss.listProcesses(function(error, processes) {
// do something
// close connection
boss.disconnect()
})
})
N.b. If you fail to close the connection to the remote daemon, your program will probably not exit.
Logging
By default boss will log messages to the console. If you wish to pass these somewhere else (or ignore them entirely, pass an additional object in to the connect function with four properties - info
, warn
, error
, debug
.
var remote = require('boss-remote'),
config = {
boss: {
rundir: '/var/run/boss',
logdir: '/var/log/boss'
},
debug: {
daemon: false
}
},
opts = {
url: 'https://my.server:1234',
key: '/path/to/private/key'
},
logger = {
info: function() {},
warn: function() {},
error: function() {},
debug: function() {}
}
remote(config, logger, opts, function(error, boss) {
// we are now connected to the boss instance
...
})
If you are making lots of connections, for convenience you may wish to bind these arguments to the function:
var remote = require('boss-remote'),
remote = remote.bind(null, {
boss: {
rundir: '/var/run/boss',
logdir: '/var/log/boss'
},
debug: {
daemon: false
}
}, {
info: function() {},
warn: function() {},
error: function() {},
debug: function() {}
}
)
remote(function(error, boss) {
// we are now connected to the boss instance
...
})