Browse Source

removed corsproxy dependency

all-modes
pbca26 8 years ago
parent
commit
b4303fa7c1
  1. BIN
      gui/agama-icon-small.png
  2. 2
      main.js
  3. 1
      package.json
  4. 136
      routes/shepherd.js

BIN
gui/agama-icon-small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

2
main.js

@ -234,7 +234,7 @@ function createLoadingWindow() {
app.on('ready', createLoadingWindow); app.on('ready', createLoadingWindow);
function createWindow (status) { function createWindow (status) {
if ( status === 'open') { if (status === 'open') {
require(path.join(__dirname, 'private/mainmenu')); require(path.join(__dirname, 'private/mainmenu'));
// initialise window // initialise window

1
package.json

@ -25,7 +25,6 @@
"dependencies": { "dependencies": {
"bluebird": "^3.4.7", "bluebird": "^3.4.7",
"body-parser": "^1.15.2", "body-parser": "^1.15.2",
"corsproxy": "^1.5.0",
"electron": "^1.6.5", "electron": "^1.6.5",
"express": "^4.14.0", "express": "^4.14.0",
"fix-path": "^2.1.0", "fix-path": "^2.1.0",

136
routes/shepherd.js

@ -809,9 +809,9 @@ shepherd.post('/forks', function(req, res, next) {
pm2.disconnect(); // Disconnect from PM2 pm2.disconnect(); // Disconnect from PM2
if (err) { if (err) {
throw err;
shepherd.writeLog(`iguana fork error: ${err}`); shepherd.writeLog(`iguana fork error: ${err}`);
console.log(`iguana fork error: ${err}`); console.log(`iguana fork error: ${err}`);
throw err;
} }
}); });
}); });
@ -1360,9 +1360,9 @@ function herder(flock, data) {
pm2.disconnect(); // Disconnect from PM2 pm2.disconnect(); // Disconnect from PM2
if (err) { if (err) {
throw err;
shepherd.writeLog(`iguana core port ${shepherd.appConfig.iguanaCorePort}`); shepherd.writeLog(`iguana core port ${shepherd.appConfig.iguanaCorePort}`);
console.log(`iguana fork error: ${err}`); console.log(`iguana fork error: ${err}`);
throw err;
} }
}); });
}); });
@ -1402,74 +1402,50 @@ function herder(flock, data) {
// 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') { if (status === 'closed') {
// start komodod via exec // start komodod via exec
//if (data.ac_name === 'komodod') { const _customParamDict = {
const _customParamDict = { 'silent': '&',
'silent': '&', 'reindex': '-reindex',
'reindex': '-reindex', 'change': '-pubkey=',
'change': '-pubkey=', 'datadir': '-datadir=',
'datadir': '-datadir=', 'rescan': '-rescan'
'rescan': '-rescan' };
}; let _customParam = '';
let _customParam = '';
if (data.ac_custom_param === 'silent' ||
if (data.ac_custom_param === 'silent' || data.ac_custom_param === 'reindex' ||
data.ac_custom_param === 'reindex') { data.ac_custom_param === 'rescan') {
_customParam = ` ${_customParamDict[data.ac_custom_param]}`; _customParam = ` ${_customParamDict[data.ac_custom_param]}`;
} else if (data.ac_custom_param === 'change' && data.ac_custom_param_value) { } else if (data.ac_custom_param === 'change' && data.ac_custom_param_value) {
_customParam = ` ${_customParamDict[data.ac_custom_param]}${data.ac_custom_param_value}`; _customParam = ` ${_customParamDict[data.ac_custom_param]}${data.ac_custom_param_value}`;
} }
console.log(`exec ${komododBin} ${data.ac_options.join(' ')}${_customParam}`); console.log(`exec ${komododBin} ${data.ac_options.join(' ')}${_customParam}`);
shepherd.writeLog(`exec ${komododBin} ${data.ac_options.join(' ')}${_customParam}`); shepherd.writeLog(`exec ${komododBin} ${data.ac_options.join(' ')}${_customParam}`);
const isChain = data.ac_name.match(/^[A-Z]*$/); const isChain = data.ac_name.match(/^[A-Z]*$/);
const coindACParam = isChain ? ` -ac_name=${data.ac_name} ` : ''; const coindACParam = isChain ? ` -ac_name=${data.ac_name} ` : '';
console.log('coindAC ' + coindACParam); console.log('coindAC ' + coindACParam);
coindInstanceRegistry[data.ac_name] = true; coindInstanceRegistry[data.ac_name] = true;
exec(`${komododBin} ${coindACParam}${data.ac_options.join(' ')}${_customParam}`, { exec(`${komododBin} ${coindACParam}${data.ac_options.join(' ')}${_customParam}`, {
maxBuffer: 1024 * 10000 // 10 mb maxBuffer: 1024 * 10000 // 10 mb
}, function(error, stdout, stderr) { }, function(error, stdout, stderr) {
// console.log('stdout: ' + stdout); shepherd.writeLog(`stdout: ${stdout}`);
// console.log('stderr: ' + stderr); shepherd.writeLog(`stderr: ${stderr}`);
shepherd.writeLog(`stdout: ${stdout}`);
shepherd.writeLog(`stderr: ${stderr}`); if (error !== null) {
console.log(`exec error: ${error}`)
if (error !== null) { shepherd.writeLog(`exec error: ${error}`);
console.log(`exec error: ${error}`)
shepherd.writeLog(`exec error: ${error}`); if (error.toString().indexOf('using -reindex') > -1) {
cache.io.emit('service', {
if (error.toString().indexOf('using -reindex') > -1) { 'komodod': {
cache.io.emit('service', { 'error': 'run -reindex'
'komodod': { }
'error': 'run -reindex' });
}
});
}
}
});
/*} else {
pm2.connect(true, function(err) { // start up pm2 god
if (err) {
console.error(err);
process.exit(2);
} }
}
pm2.start({ });
script: komododBin, // path to binary
name: data.ac_name, // REVS, USD, EUR etc.
exec_mode : 'fork',
cwd: komodoDir,
args: data.ac_options
}, function(err, apps) {
shepherd.writeLog(`komodod fork started ${data.ac_name} ${JSON.stringify(data.ac_options)}`);
pm2.disconnect(); // Disconnect from PM2
if (err)
throw err;
});
});
}*/
} else { } else {
console.log(`port ${_port} (${data.ac_name}) is already in use`); console.log(`port ${_port} (${data.ac_name}) is already in use`);
shepherd.writeLog(`port ${_port} (${data.ac_name}) is already in use`); shepherd.writeLog(`port ${_port} (${data.ac_name}) is already in use`);
@ -1510,30 +1486,6 @@ function herder(flock, data) {
}); });
}); });
} }
// deprecated, to be removed
if (flock === 'corsproxy') {
console.log('corsproxy flock selected...');
console.log(`selected data: ${data}`);
pm2.connect(true,function(err) { //start up pm2 god
if (err) {
console.error(err);
process.exit(2);
}
pm2.start({
script: CorsProxyBin, // path to binary
name: 'CORSPROXY',
exec_mode : 'fork',
cwd: iguanaDir
}, function(err, apps) {
pm2.disconnect(); // Disconnect from PM2
if (err)
throw err;
});
});
}
} }
function slayer(flock) { function slayer(flock) {

Loading…
Cancel
Save