adding listen address to config

This commit is contained in:
Alex Kocharin 2013-09-24 08:40:46 +04:00
parent 764dde38f1
commit e351559dd2
2 changed files with 6 additions and 2 deletions

View File

@ -9,7 +9,7 @@ var crypto = require('crypto');
var pkg = require(pkg_file);
commander
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)', '4873')
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)')
.option('-c, --config <config.yaml>', 'use this configuration file (default: ./config.yaml)')
.version(pkg.version)
.parse(process.argv);
@ -33,7 +33,8 @@ if (commander.config) {
if (!config.user_agent) config.user_agent = 'Sinopia/'+pkg.version;
if (!config.self_path) config.self_path = config_path;
var hostport = commander.listen.split(':');
var hostport = commander.listen || config.listen || '4873';
hostport = hostport.split(':');
if (hostport.length < 2) {
hostport = [undefined, hostport[0]];
}

View File

@ -40,3 +40,6 @@ packages:
# if you use nginx with custom path, use this to override links
#url_prefix: https://dev.company.local/sinopia/
# you can specify listen address (or simply a port)
#listen: localhost:4873