Browse Source

read app version from local file

all-modes
pbca26 8 years ago
parent
commit
384101915c
  1. 13
      main.js
  2. 23
      routes/shepherd.js

13
main.js

@ -28,9 +28,19 @@ var express = require('express'),
Promise = require('bluebird'); Promise = require('bluebird');
// read app version
const localVersionFile = fs.readFileSync(`version`, 'utf8');
let localVersion;
if (localVersionFile.indexOf('\r\n') > -1) {
localVersion = localVersionFile.split('\r\n');
} else {
localVersion = localVersionFile.split('\n');
}
const appBasicInfo = { const appBasicInfo = {
name: 'Agama', name: 'Agama',
version: '0.2.0.21a-beta' version: localVersion[0],
}; };
app.setName(appBasicInfo.name); app.setName(appBasicInfo.name);
@ -300,6 +310,7 @@ function createWindow (status) {
if (appConfig.v2) { if (appConfig.v2) {
shepherd.writeLog('show edex gui'); shepherd.writeLog('show edex gui');
mainWindow.appConfig = appConfig; mainWindow.appConfig = appConfig;
mainWindow.appBasicInfo = appBasicInfo;
mainWindow.appSessionHash = appSessionHash; mainWindow.appSessionHash = appSessionHash;
if (appConfig.dev) { if (appConfig.dev) {

23
routes/shepherd.js

@ -1163,6 +1163,7 @@ shepherd.post('/forks', function(req, res, next) {
args: [`-port=${_port}`], args: [`-port=${_port}`],
cwd: iguanaDir //set correct iguana directory cwd: iguanaDir //set correct iguana directory
}, function(err, apps) { }, function(err, apps) {
if (apps && apps[0] && apps[0].process && apps[0].process.pid) {
iguanaInstanceRegistry[_port] = { iguanaInstanceRegistry[_port] = {
'mode': mode, 'mode': mode,
'coin': coin, 'coin': coin,
@ -1171,6 +1172,21 @@ shepherd.post('/forks', function(req, res, next) {
}; };
cache.setVar('iguanaInstances', iguanaInstanceRegistry); cache.setVar('iguanaInstances', iguanaInstanceRegistry);
const successObj = {
'msg': 'success',
'result': _port
};
res.end(JSON.stringify(successObj));
} else {
const errorObj = {
'msg': 'success',
'error': 'iguana start error'
};
res.end(JSON.stringify(errorObj));
}
// get sync only forks info // get sync only forks info
if (syncOnlyInstanceInterval === -1) { if (syncOnlyInstanceInterval === -1) {
setTimeout(function() { setTimeout(function() {
@ -1181,13 +1197,6 @@ shepherd.post('/forks', function(req, res, next) {
}, 20000); }, 20000);
} }
const successObj = {
'msg': 'success',
'result': _port
};
res.end(JSON.stringify(successObj));
pm2.disconnect(); // Disconnect from PM2 pm2.disconnect(); // Disconnect from PM2
if (err) { if (err) {
shepherd.writeLog(`iguana fork error: ${err}`); shepherd.writeLog(`iguana fork error: ${err}`);

Loading…
Cancel
Save