fixed env vars
This commit is contained in:
parent
63307f35bb
commit
a019d77205
@ -54,9 +54,4 @@ cd www
|
|||||||
sudo npm install
|
sudo npm install
|
||||||
sudo npm install pm2 -g
|
sudo npm install pm2 -g
|
||||||
|
|
||||||
export EC2_INSTANCE_ID=$(ec2metadata --instance-id)
|
pm2 start processes.json
|
||||||
export ETH_VERSION="$(/home/ubuntu/bin/eth -V)"
|
|
||||||
|
|
||||||
# pm2 start processes.json
|
|
||||||
# pm2 startup ubuntu
|
|
||||||
# pm3 save
|
|
||||||
|
14
lib/node.js
14
lib/node.js
@ -1,6 +1,7 @@
|
|||||||
var web3 = require('ethereum.js');
|
var web3 = require('ethereum.js');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
|
var shelljs = require('shelljs');
|
||||||
|
|
||||||
var Primus = require('primus'),
|
var Primus = require('primus'),
|
||||||
Emitter = require('primus-emit'),
|
Emitter = require('primus-emit'),
|
||||||
@ -12,6 +13,15 @@ Socket = Primus.createSocket({
|
|||||||
plugin: {emitter: Emitter}
|
plugin: {emitter: Emitter}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var INSTANCE_NAME,
|
||||||
|
ETH_VERSION;
|
||||||
|
|
||||||
|
if(process.env.NODE_ENV == 'production')
|
||||||
|
{
|
||||||
|
INSTANCE_NAME = shelljs.exec('ec2metadata --instance-id', {silent: true}).output;
|
||||||
|
ETH_VERSION = shelljs.exec('eth -V', {silent: true}).output;
|
||||||
|
}
|
||||||
|
|
||||||
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000');
|
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000');
|
||||||
|
|
||||||
var MAX_BLOCKS_HISTORY = 12,
|
var MAX_BLOCKS_HISTORY = 12,
|
||||||
@ -22,8 +32,8 @@ function Node()
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.info = {
|
this.info = {
|
||||||
name: process.env.EC2_INSTANCE_ID || os.hostname(),
|
name: INSTANCE_NAME || (process.env.EC2_INSTANCE_ID || os.hostname()),
|
||||||
node: process.env.ETH_VERSION || 'eth version 0.8.1',
|
node: ETH_VERSION || (process.env.ETH_VERSION || 'eth version 0.8.1'),
|
||||||
os: os.platform(),
|
os: os.platform(),
|
||||||
os_v: os.release()
|
os_v: os.release()
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"lodash": "^3.2.0",
|
"lodash": "^3.2.0",
|
||||||
"primus": "^2.4.12",
|
"primus": "^2.4.12",
|
||||||
"primus-emit": "^0.1.2",
|
"primus-emit": "^0.1.2",
|
||||||
|
"shelljs": "^0.3.0",
|
||||||
"ws": "^0.7.1"
|
"ws": "^0.7.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user