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