Browse Source

added dev flag

all-modes
pbca26 8 years ago
parent
commit
97f3e9897f
  1. 6
      main.js
  2. 7
      routes/shepherd.js

6
main.js

@ -47,12 +47,12 @@ if (appConfig.killIguanaOnStart) {
}
if (os.platform() === 'win32') {
iguanaGrep = 'tasklist';
}
}
exec(iguanaGrep, function(error, stdout, stderr) {
if (stdout.indexOf('iguana') > -1) {
console.log('found another iguana process(es)');
var pkillCmd = os.platform() === 'win32' ? 'taskkill /f /im iguana.exe' : 'pkill iguana';
exec(pkillCmd, function(error, stdout, stderr) {
console.log(pkillCmd + ' is issued');
if (error !== null) {
@ -68,7 +68,7 @@ if (appConfig.killIguanaOnStart) {
}
guiapp.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*'/*'http://127.0.0.1:' + appConfig.iguanaAppPort*/);
res.header('Access-Control-Allow-Origin', appConfig.dev ? '*' : 'http://127.0.0.1:' + appConfig.iguanaAppPort);
res.header('Access-Control-Allow-Headers', 'X-Requested-With');
res.header('Access-Control-Allow-Credentials', 'true');
res.header('Access-Control-Allow-Headers', 'Content-Type');

7
routes/shepherd.js

@ -88,7 +88,8 @@ shepherd.appConfig = {
"darwin": 90000,
"linux": 1000000
},
"killIguanaOnStart": false
"killIguanaOnStart": false,
"dev": false
};
shepherd.saveLocalAppConf = function(appSettings) {
@ -658,7 +659,7 @@ function herder(flock, data) {
try {
// check if komodod instance is already running
portscanner.checkPortStatus(_port, '127.0.0.1', function(error, status) {
// Status is 'open' if currently in use or 'closed' if available
// Status is 'open' if currently in use or 'closed' if available
if (status === 'closed') {
pm2.connect(true, function(err) { // start up pm2 god
if (err) {
@ -677,7 +678,7 @@ function herder(flock, data) {
if (err)
throw err;
});
});
});
} else {
console.log('port ' + _port + ' (' + data.ac_name + ') is already in use');
}

Loading…
Cancel
Save