Skip to content

Commit

Permalink
Merge pull request #10 from gdaszuta/master
Browse files Browse the repository at this point in the history
Allow binding AGI server to specified host
  • Loading branch information
antirek authored Apr 19, 2017
2 parents fb2531c + 78f5532 commit 4eb65ed
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ var agi = function (handler, optionsIn) {

var settings = {
port: options.port || 3000,
debug: options.debug || false
debug: options.debug || false,
host: options.host,
};

var handle = function (stream) {
var context = new Context(stream, settings.debug);
handler(context);
};

var start = function (portIn) {
var start = function (portIn, hostIn) {
var port = portIn || settings.port;
return require('net').createServer(handle).listen(port);
var host = hostIn || settings.host;
return require('net').createServer(handle).listen(port, host);
};

return {
start: start
};
};

module.exports = agi;
module.exports = agi;

0 comments on commit 4eb65ed

Please sign in to comment.