fixed env vars

This commit is contained in:
cubedro
2015-02-18 00:15:34 +02:00
parent 63307f35bb
commit a019d77205
3 changed files with 14 additions and 8 deletions

View File

@@ -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()
};