From 3237db0d1acde0634f1d067d75ab0f98935405ef Mon Sep 17 00:00:00 2001 From: cubedro Date: Wed, 19 Aug 2015 21:00:47 +0300 Subject: [PATCH] fixed WS_SECRET bug --- .gitignore | 1 + app.js | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a5bd055..710630c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ config/nodes.js *.swp *.pem .node-xmlhttprequest-* +ws_secret.js \ No newline at end of file diff --git a/app.js b/app.js index ebb44d3..eb4701f 100644 --- a/app.js +++ b/app.js @@ -3,13 +3,10 @@ var logger = require('./lib/utils/logger'); var chalk = require('chalk'); var http = require('http'); +// Init WS SECRET var 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 ) { @@ -20,6 +17,16 @@ else 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;