diff --git a/bin/build.sh b/bin/build.sh index 7d7f4f2..895ff9f 100644 --- a/bin/build.sh +++ b/bin/build.sh @@ -56,6 +56,11 @@ cd ~ ln -s ~/opt/cpp-ethereum-build/alethzero/alethzero ~/bin/alethzero ln -s ~/opt/cpp-ethereum-build/eth/eth ~/bin/eth +# install cloud-utils to fetch instance meta-data +sudo apt-get -y install cloud-utils +EC2_INSTANCE_ID=$(ec2metadata --instance-id) +ETH_VERSION=$(eth -V) + # add node service cd ~/bin [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www diff --git a/lib/node.js b/lib/node.js index 341723d..7df2972 100644 --- a/lib/node.js +++ b/lib/node.js @@ -23,8 +23,8 @@ function Node() var self = this; this.info = { - name: process.env.ETH_CLIENT || 'C++', - type: process.env.ETH_TYPE || '0.8.1', + name: process.env.EC2_INSTANCE_ID || 'Local Node', + node: process.env.ETH_VERSION || 'eth version 0.8.1', os: os.platform(), os_v: os.release() }; @@ -49,7 +49,7 @@ function Node() errors: [] } - this.socket = null; + this._socket = null; this.pendingWatch = false; this.chainWatch = false; this.updateInterval = false; @@ -59,11 +59,11 @@ function Node() // this.init(); socket.on('open', function open() { - self.socket = true; + self._socket = true; self.emit('hello', self.info); console.log('The connection has been opened.'); }).on('end', function end() { - self.socket = false; + self._socket = false; }).on('error', function error(err) { console.log(err); }).on('reconnecting', function reconnecting(opts) { @@ -278,7 +278,7 @@ Node.prototype.setWatches = function() Node.prototype.emit = function(message, payload) { - if(this.socket){ + if(this._socket){ try { socket.emit(message, payload); } @@ -296,7 +296,7 @@ Node.prototype.init = function() Node.prototype.stop = function() { - if(this.socket) + if(this._socket) socket.end(socket.id); if(this.updateInterval)