add support for -p option in embark run to specify web server port
This commit is contained in:
parent
1140ebf075
commit
19735884c0
|
@ -62,12 +62,13 @@ Cmd.prototype.run = function() {
|
|||
var self = this;
|
||||
program
|
||||
.command('run [environment]')
|
||||
.option('-p, --port [port]', 'port to run the dev webserver')
|
||||
.description('run dapp (default: development)')
|
||||
.action(function(env, options) {
|
||||
self.Embark.initConfig(env || 'development', {
|
||||
embarkConfig: 'embark.json'
|
||||
});
|
||||
self.Embark.run(env || 'development');
|
||||
self.Embark.run({env: env || 'development', serverPort: options.port});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -86,8 +86,9 @@ var Embark = {
|
|||
});
|
||||
},
|
||||
|
||||
run: function(env) {
|
||||
run: function(options) {
|
||||
var self = this;
|
||||
var env = options.env;
|
||||
async.waterfall([
|
||||
function startConsole(callback) {
|
||||
Embark.console = new Console();
|
||||
|
@ -105,7 +106,8 @@ var Embark = {
|
|||
function monitorServices(callback) {
|
||||
Embark.servicesMonitor = new ServicesMonitor({
|
||||
logger: Embark.logger,
|
||||
config: Embark.config
|
||||
config: Embark.config,
|
||||
serverPort: options.serverPort
|
||||
});
|
||||
Embark.servicesMonitor.startMonitor();
|
||||
callback();
|
||||
|
@ -139,7 +141,7 @@ var Embark = {
|
|||
},
|
||||
function startAssetServer(callback) {
|
||||
Embark.monitor.setStatus("Starting Server");
|
||||
var server = new Server({logger: self.logger});
|
||||
var server = new Server({logger: self.logger, port: options.serverPort});
|
||||
server.start(callback);
|
||||
},
|
||||
function watchFilesForChanges(callback) {
|
||||
|
|
|
@ -6,6 +6,7 @@ var ServicesMonitor = function(options) {
|
|||
this.logger = options.logger;
|
||||
this.interval = options.interval || 5000;
|
||||
this.config = options.config;
|
||||
this.serverPort = options.serverPort || 8000;
|
||||
};
|
||||
|
||||
ServicesMonitor.prototype.startMonitor = function() {
|
||||
|
@ -63,7 +64,7 @@ ServicesMonitor.prototype.check = function() {
|
|||
},
|
||||
function checkDevServer(result, callback) {
|
||||
self.logger.trace('checkDevServer');
|
||||
result.push('dev server (http://localhost:8000)'.green);
|
||||
result.push(('dev server (http://localhost:' + self.serverPort + ')').green);
|
||||
callback(null, result);
|
||||
}
|
||||
], function(err, result) {
|
||||
|
|
Loading…
Reference in New Issue