From 6f211ac120c117b2291c400fb9d7427b3676faed Mon Sep 17 00:00:00 2001 From: pbca26 Date: Mon, 12 Jun 2017 23:14:19 +0300 Subject: [PATCH] coind optional start param --- routes/shepherd.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/routes/shepherd.js b/routes/shepherd.js index f4e5daf..0b05699 100644 --- a/routes/shepherd.js +++ b/routes/shepherd.js @@ -94,6 +94,10 @@ shepherd.appConfig = { "v2": true, "useBasiliskInstance": true, "debug": true, + "cli": { + "passthru": false, + "default": false + } }; shepherd.writeLog = function(data) { @@ -1219,10 +1223,24 @@ function herder(flock, data) { if (status === 'closed') { // start komodod via exec if (data.ac_name === 'komodod') { - console.log('exec' + komododBin + ' ' + data.ac_options.join(' ')); - shepherd.writeLog('exec' + komododBin + ' ' + data.ac_options.join(' ')); + const _customParamDict = { + 'silent': '&', + 'reindex': '-reindex', + 'change': '-pubkey=' + }; + const _customParam; + + if (data.ac_custom_param === 'silent' || + data.ac_custom_param === 'reindex') { + _customParam = ' ' + _customParamDict[data.ac_custom_param]; + } else if (data.ac_custom_param === 'change' && 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); + shepherd.writeLog('exec' + komododBin + ' ' + data.ac_options.join(' ') + _customParam); - exec(komododBin + ' ' + data.ac_options.join(' '), { + exec(komododBin + ' ' + data.ac_options.join(' ') + _customParam, { maxBuffer: 1024 * 10000 // 10 mb }, function(error, stdout, stderr) { // console.log('stdout: ' + stdout);