mirror of https://github.com/BTCPrivate/z-nomp.git
Merge pull request #159 from madbuda/redispw
adding in redis password auth from UNOMP
This commit is contained in:
commit
4c982a73ac
|
@ -25,7 +25,8 @@
|
||||||
},
|
},
|
||||||
"redis": {
|
"redis": {
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
"port": 6379
|
"port": 6379,
|
||||||
|
"password": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,9 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
logger[severity](logSystem, logComponent, message);
|
logger[severity](logSystem, logComponent, message);
|
||||||
});
|
});
|
||||||
var redisClient = redis.createClient(poolOptions.redis.port, poolOptions.redis.host);
|
var redisClient = redis.createClient(poolOptions.redis.port, poolOptions.redis.host);
|
||||||
|
// redis auth if enabled
|
||||||
|
redisClient.auth(poolOptions.redis.password);
|
||||||
|
|
||||||
var magnitude;
|
var magnitude;
|
||||||
var minPaymentSatoshis;
|
var minPaymentSatoshis;
|
||||||
var coinPrecision;
|
var coinPrecision;
|
||||||
|
|
|
@ -19,6 +19,8 @@ module.exports = function(logger){
|
||||||
var proxySwitch = {};
|
var proxySwitch = {};
|
||||||
|
|
||||||
var redisClient = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
var redisClient = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
||||||
|
// redis auth if enabled
|
||||||
|
redisClient.auth(portalConfig.redis.password);
|
||||||
|
|
||||||
//Handle messages from master process sent via IPC
|
//Handle messages from master process sent via IPC
|
||||||
process.on('message', function(message) {
|
process.on('message', function(message) {
|
||||||
|
|
|
@ -27,6 +27,9 @@ module.exports = function(logger, poolConfig){
|
||||||
var logSubCat = 'Thread ' + (parseInt(forkId) + 1);
|
var logSubCat = 'Thread ' + (parseInt(forkId) + 1);
|
||||||
|
|
||||||
var connection = redis.createClient(redisConfig.port, redisConfig.host);
|
var connection = redis.createClient(redisConfig.port, redisConfig.host);
|
||||||
|
// redis auth if needed
|
||||||
|
connection.auth(redisConfig.password);
|
||||||
|
|
||||||
connection.on('ready', function(){
|
connection.on('ready', function(){
|
||||||
logger.debug(logSystem, logComponent, logSubCat, 'Share processing setup with redis (' + redisConfig.host +
|
logger.debug(logSystem, logComponent, logSubCat, 'Share processing setup with redis (' + redisConfig.host +
|
||||||
':' + redisConfig.port + ')');
|
':' + redisConfig.port + ')');
|
||||||
|
|
|
@ -7,6 +7,13 @@ var os = require('os');
|
||||||
|
|
||||||
var algos = require('stratum-pool/lib/algoProperties.js');
|
var algos = require('stratum-pool/lib/algoProperties.js');
|
||||||
|
|
||||||
|
// redis callback Ready check failed bypass trick
|
||||||
|
function rediscreateClient(port, host, pass) {
|
||||||
|
var client = redis.createClient(port, host);
|
||||||
|
client.auth(pass);
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
function balanceRound(number) {
|
function balanceRound(number) {
|
||||||
return parseFloat((Math.round(number * 100000000) / 100000000).toFixed(8));
|
return parseFloat((Math.round(number * 100000000) / 100000000).toFixed(8));
|
||||||
}
|
}
|
||||||
|
@ -80,14 +87,14 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
||||||
}
|
}
|
||||||
redisClients.push({
|
redisClients.push({
|
||||||
coins: [coin],
|
coins: [coin],
|
||||||
client: redis.createClient(redisConfig.port, redisConfig.host)
|
client: rediscreateClient(redisConfig.port, redisConfig.host, redisConfig.password)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupStatsRedis(){
|
function setupStatsRedis(){
|
||||||
redisStats = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
redisStats = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
||||||
redisStats.on('error', function(err){
|
redisStats.on('error', function(err){
|
||||||
logger.error(logSystem, 'Historics', 'Redis for stats had an error ' + JSON.stringify(err));
|
redisStats.auth(portalConfig.redis.password);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ module.exports = function(logger){
|
||||||
var keyScriptTemplate = '';
|
var keyScriptTemplate = '';
|
||||||
var keyScriptProcessed = '';
|
var keyScriptProcessed = '';
|
||||||
|
|
||||||
|
|
||||||
var processTemplates = function(){
|
var processTemplates = function(){
|
||||||
|
|
||||||
for (var pageName in pageTemplates){
|
for (var pageName in pageTemplates){
|
||||||
|
@ -135,6 +134,7 @@ module.exports = function(logger){
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(callback){
|
function(callback){
|
||||||
var client = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
var client = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
||||||
|
client.auth(portalConfig.redis.password);
|
||||||
client.hgetall('coinVersionBytes', function(err, coinBytes){
|
client.hgetall('coinVersionBytes', function(err, coinBytes){
|
||||||
if (err){
|
if (err){
|
||||||
client.quit();
|
client.quit();
|
||||||
|
|
Loading…
Reference in New Issue