Add json.minify so comments can be used in config files

This commit is contained in:
Matthew Little 2014-01-16 12:18:16 -07:00
parent 6cb4ba8c8c
commit 02fa67febe
3 changed files with 15 additions and 13 deletions

View File

@ -5,7 +5,7 @@
"reward": "POW",
"address": "nhfNedMmQ1Rjb62znwaiJgFhL3f4NQztSp",
"stratumPort": 3334,
"difficulty": 16,
"difficulty": 32,
"blockRefreshInterval": 1,
"daemon": {
"host": "localhost",
@ -14,12 +14,12 @@
"password": "testnet"
},
"varDiff": {
"enabled": true,
"minDifficulty": 4,
"maxDifficulty": 1000,
"daemonDiffUpdateFrequency": 3600,
"targetTime": 10,
"retargetTime": 120,
"variancePercent": 20
"enabled": true, //set to false to disable vardiff functionality
"minDifficulty": 16, //minimum difficulty. below 16 will cause problems
"maxDifficulty": 1000, //network difficulty will be used if it is lower than this
"daemonDiffUpdateFrequency": 3600, //get the network difficulty every this many seconds
"targetTime": 30, //target time per share (i.e. try to get 1 share per this many seconds)
"retargetTime": 120, //check to see if we should retarget every this many seconds
"variancePercent": 20 //allow average time to very this % from target without retarget
}
}

View File

@ -1,8 +1,9 @@
var fs = require('fs');
var dateFormat = require('dateformat');
var Stratum = require('stratum-pool');
var PoolLogger = require('./libs/logutils.js');
JSON.minify = JSON.minify || require("node-json-minify");
var loggerInstance = new PoolLogger({
'default': true,
'keys': {
@ -16,7 +17,7 @@ var logDebug = loggerInstance.logDebug;
var logWarning = loggerInstance.logWarning;
var logError = loggerInstance.logError;
var config = JSON.parse(fs.readFileSync("config.json"));
var config = JSON.parse(JSON.minify(fs.readFileSync("config.json", {encoding: 'utf8'})));
var stratum = new Stratum(config);
@ -27,7 +28,7 @@ stratum.on('log', function(logText){
fs.readdirSync('coins').forEach(function(file){
var coinOptions = JSON.parse(fs.readFileSync('coins/' + file, {encoding: 'utf8'}));
var coinOptions = JSON.parse(JSON.minify(fs.readFileSync('coins/' + file, {encoding: 'utf8'})));
var authorizeFN = function (ip, workerName, password, callback) {
// Default implementation just returns true

View File

@ -4,8 +4,9 @@
"description": "Node quick start example portal",
"main": "init.js",
"dependencies": {
"stratum-pool": "~0.0.2",
"dateformat": "~1.0.7-1.2.3"
"stratum-pool": "*",
"dateformat": "*",
"node-json-minify": "*"
},
"devDependencies": {},
"scripts": {