Merge pull request #264 from cubedro/develop

fixed WS_SECRET bug
This commit is contained in:
Marian OANCΞA 2015-08-19 21:01:00 +03:00
commit fa3e8d8912
2 changed files with 12 additions and 4 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ config/nodes.js
*.swp *.swp
*.pem *.pem
.node-xmlhttprequest-* .node-xmlhttprequest-*
ws_secret.js

15
app.js
View File

@ -3,13 +3,10 @@ var logger = require('./lib/utils/logger');
var chalk = require('chalk'); var chalk = require('chalk');
var http = require('http'); var http = require('http');
// Init WS SECRET
var WS_SECRET; var WS_SECRET;
if( !_.isUndefined(process.env.WS_SECRET) && !_.isNull(process.env.WS_SECRET) ) if( !_.isUndefined(process.env.WS_SECRET) && !_.isNull(process.env.WS_SECRET) )
{
WS_SECRET = ["eth-net-stats-has-a-secret"];
}
else
{ {
if( process.env.WS_SECRET.indexOf('|') > 0 ) if( process.env.WS_SECRET.indexOf('|') > 0 )
{ {
@ -20,6 +17,16 @@ else
WS_SECRET = process.env.WS_SECRET.split(''); WS_SECRET = process.env.WS_SECRET.split('');
} }
} }
else
{
try {
WS_SECRET = require('./ws_secret.js');
}
catch (e)
{
console.error("WS_SECRET NOT SET");
}
}
var banned = require('./lib/utils/config').banned; var banned = require('./lib/utils/config').banned;