Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[fix] allow env and port to be configurable by config file
  • Loading branch information
jcrugzz committed Nov 6, 2013
1 parent d0c0bc5 commit 328e041
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bin/composer
Expand Up @@ -4,7 +4,7 @@ var util = require('util'),
path = require('path'),
argv = require('optimist').argv,
composer = require('../lib/composer');

var help = [
"usage: composer [options]",
"",
Expand All @@ -21,19 +21,20 @@ if (argv.h || argv.help) {
}

var address = argv.a || composer.common.ipAddress(),
configFile = argv.c || argv.config,
env = argv.e || 'development',
port = argv.p || 9004,
ipAddress;
configFile = argv.c || argv.config;

configFile = configFile
? path.resolve(configFile)
: path.join(__dirname, '..', 'config', 'env', 'development.json');

console.log('Configuring composer'.magenta + ' with ' + configFile.yellow);
console.log('Starting composer'.magenta + ' in ' + env.yellow);
composer.config.file(configFile);

var env = argv.e || composer.config.get('env') || 'development',
port = argv.p || composer.config.get('port') || 9004;

console.log('Starting composer'.magenta + ' in ' + env.yellow);

composer.start(port, function (err, server) {
if (err) {
return log('Error starting Composer: ' + err.message);
Expand Down

0 comments on commit 328e041

Please sign in to comment.