Updates to fix a .sql bug. Adding a script to migrate configuration values in the future.

This commit is contained in:
Alexander Blair 2017-02-11 11:47:36 -08:00
parent 0c25ef094d
commit 9977bae7b4
3 changed files with 544 additions and 1 deletions

View file

@ -1,5 +1,5 @@
UPDATE pool.config SET item_value = '' WHERE module = 'pool' and item = 'address';
UPDATE pool.config SET item_value = '' WHERE module = 'pool' and item = 'feeAddress';
UPDATE pool.config SET item_value = '' WHERE module = 'payout' and item = 'feeAddress';
UPDATE pool.config SET item_value = '' WHERE module = 'general' and item = 'mailgunKey';
UPDATE pool.config SET item_value = '' WHERE module = 'general' and item = 'mailgunURL';
UPDATE pool.config SET item_value = '' WHERE module = 'general' and item = 'emailFrom';

View file

@ -0,0 +1,514 @@
[
{
"id": 1,
"module": "pool",
"item": "address",
"item_value": "44GWfqCiW7PH3njtPPfAY5Q38x8QfQCeGjKFp4WejNoTAWq7apSrR2jRLERFmpbh4V9knMZz4GrG2bgQMfmc3w888p7x4sd",
"item_type": "string",
"Item_desc": "Address to mine to, this should be the wallet-rpc address."
},
{
"id": 2,
"module": "pool",
"item": "minerTimeout",
"item_value": "900",
"item_type": "int",
"Item_desc": "Length of time before a miner is flagged inactive."
},
{
"id": 3,
"module": "pool",
"item": "banEnabled",
"item_value": "true",
"item_type": "bool",
"Item_desc": "Enables/disabled banning of \"bad\" miners."
},
{
"id": 4,
"module": "pool",
"item": "banLength",
"item_value": "-15m",
"item_type": "string",
"Item_desc": "Ban duration except perma-bans"
},
{
"id": 5,
"module": "pool",
"item": "targetTime",
"item_value": "30",
"item_type": "int",
"Item_desc": "Time in seconds between share finds"
},
{
"id": 6,
"module": "pool",
"item": "trustThreshold",
"item_value": "30",
"item_type": "int",
"Item_desc": "Number of shares before miner trust can kick in."
},
{
"id": 8,
"module": "pool",
"item": "banPercent",
"item_value": "25",
"item_type": "int",
"Item_desc": "Percentage of shares that need to be invalid to be banned."
},
{
"id": 9,
"module": "pool",
"item": "banThreshold",
"item_value": "30",
"item_type": "int",
"Item_desc": "Number of shares before bans can begin"
},
{
"id": 10,
"module": "pool",
"item": "trustedMiners",
"item_value": "true",
"item_type": "bool",
"Item_desc": "Enable the miner trust system"
},
{
"id": 11,
"module": "pool",
"item": "trustChange",
"item_value": "1",
"item_type": "int",
"Item_desc": "Change in the miner trust in percent"
},
{
"id": 12,
"module": "pool",
"item": "trustMin",
"item_value": "20",
"item_type": "int",
"Item_desc": "Minimum level of miner trust"
},
{
"id": 13,
"module": "pool",
"item": "trustPenalty",
"item_value": "30",
"item_type": "int",
"Item_desc": "Number of shares that must be successful to be trusted, reset to this value if trust share is broken"
},
{
"id": 14,
"module": "pool",
"item": "retargetTime",
"item_value": "60",
"item_type": "int",
"Item_desc": "Time between difficulty retargets"
},
{
"id": 15,
"module": "daemon",
"item": "address",
"item_value": "127.0.0.1",
"item_type": "string",
"Item_desc": "Monero Daemon RPC IP"
},
{
"id": 16,
"module": "daemon",
"item": "port",
"item_value": "18081",
"item_type": "int",
"Item_desc": "Monero Daemon RPC Port"
},
{
"id": 17,
"module": "wallet",
"item": "address",
"item_value": "127.0.0.1",
"item_type": "string",
"Item_desc": "Monero Daemon RPC Wallet IP"
},
{
"id": 18,
"module": "wallet",
"item": "port",
"item_value": "37458",
"item_type": "int",
"Item_desc": "Monero Daemon RPC Wallet Port"
},
{
"id": 21,
"module": "rpc",
"item": "https",
"item_value": "false",
"item_type": "bool",
"Item_desc": "Enable RPC over SSL"
},
{
"id": 22,
"module": "pool",
"item": "maxDifficulty",
"item_value": "500000",
"item_type": "int",
"Item_desc": "Maximum difficulty for VarDiff"
},
{
"id": 23,
"module": "pool",
"item": "minDifficulty",
"item_value": "100",
"item_type": "int",
"Item_desc": "Minimum difficulty for VarDiff"
},
{
"id": 24,
"module": "pool",
"item": "varDiffVariance",
"item_value": "20",
"item_type": "int",
"Item_desc": "Percentage out of the target time that difficulty changes"
},
{
"id": 25,
"module": "pool",
"item": "varDiffMaxChange",
"item_value": "30",
"item_type": "int",
"Item_desc": "Percentage amount that the difficulty may change"
},
{
"id": 27,
"module": "payout",
"item": "btcFee",
"item_value": "1.5",
"item_type": "float",
"Item_desc": "Fee charged for auto withdrawl via BTC"
},
{
"id": 28,
"module": "payout",
"item": "ppsFee",
"item_value": "6.5",
"item_type": "float",
"Item_desc": "Fee charged for usage of the PPS pool"
},
{
"id": 29,
"module": "payout",
"item": "pplnsFee",
"item_value": ".6",
"item_type": "float",
"Item_desc": "Fee charged for the usage of the PPLNS pool"
},
{
"id": 30,
"module": "payout",
"item": "propFee",
"item_value": ".7",
"item_type": "float",
"Item_desc": "Fee charged for the usage of the proportial pool"
},
{
"id": 31,
"module": "payout",
"item": "soloFee",
"item_value": ".4",
"item_type": "float",
"Item_desc": "Fee charged for usage of the solo mining pool"
},
{
"id": 32,
"module": "payout",
"item": "exchangeMin",
"item_value": "5",
"item_type": "float",
"Item_desc": "Minimum XMR balance for payout to exchange/payment ID"
},
{
"id": 33,
"module": "payout",
"item": "walletMin",
"item_value": ".3",
"item_type": "float",
"Item_desc": "Minimum XMR balance for payout to personal wallet"
},
{
"id": 34,
"module": "payout",
"item": "devDonation",
"item_value": "5",
"item_type": "float",
"Item_desc": "Donation to XMR core development"
},
{
"id": 35,
"module": "payout",
"item": "poolDevDonation",
"item_value": "0",
"item_type": "float",
"Item_desc": "Donation to pool developer"
},
{
"id": 36,
"module": "payout",
"item": "denom",
"item_value": ".000001",
"item_type": "float",
"Item_desc": "Minimum balance that will be paid out to."
},
{
"id": 37,
"module": "payout",
"item": "blocksRequired",
"item_value": "60",
"item_type": "int",
"Item_desc": "Blocks required to validate a payout before it's performed."
},
{
"id": 38,
"module": "general",
"item": "sigDivisor",
"item_value": "1000000000000",
"item_type": "int",
"Item_desc": "Divisor for turning coin into human readable amounts "
},
{
"id": 39,
"module": "payout",
"item": "feeAddress",
"item_value": "48WnWpKMuLrfgy4YpjPjoYSDyqgVx5fCSgrSydVPy7Jmii4y2TwEi8DcH5TM9aRm56jGQnXmurXBeTWe3xjCKbjuAX1qYZt",
"item_type": "string",
"Item_desc": "Address that pool fees are sent to."
},
{
"id": 40,
"module": "payout",
"item": "feesForTXN",
"item_value": "10",
"item_type": "int",
"Item_desc": "Amount of XMR that is left from the fees to pay miner fees."
},
{
"id": 41,
"module": "payout",
"item": "maxTxnValue",
"item_value": "250",
"item_type": "int",
"Item_desc": "Maximum amount of XMR to send in a single transaction"
},
{
"id": 42,
"module": "payout",
"item": "shapeshiftPair",
"item_value": "xmr_btc",
"item_type": "string",
"Item_desc": "Pair to use in all shapeshift lookups for auto BTC payout"
},
{
"id": 43,
"module": "general",
"item": "coinCode",
"item_value": "XMR",
"item_type": "string",
"Item_desc": "Coincode to be loaded up w/ the shapeshift getcoins argument."
},
{
"id": 44,
"module": "general",
"item": "allowBitcoin",
"item_value": "true",
"item_type": "bool",
"Item_desc": "Allow the pool to auto-payout to BTC via ShapeShift"
},
{
"id": 45,
"module": "payout",
"item": "exchangeRate",
"item_value": "1217200",
"item_type": "float",
"Item_desc": "Current exchange rate"
},
{
"id": 46,
"module": "payout",
"item": "bestExchange",
"item_value": "xmrto",
"item_type": "string",
"Item_desc": "Current best exchange"
},
{
"id": 47,
"module": "payout",
"item": "mixIn",
"item_value": "4",
"item_type": "int",
"Item_desc": "Mixin count for coins that support such things."
},
{
"id": 48,
"module": "pool",
"item": "geoDNS",
"item_value": "mine.xmrpool.net",
"item_type": "string",
"Item_desc": "geoDNS enabled address for the pool."
},
{
"id": 49,
"module": "general",
"item": "statsBufferLength",
"item_value": "120",
"item_type": "int",
"Item_desc": "Number of items to be cached in the stats buffers."
},
{
"id": 50,
"module": "api",
"item": "authKey",
"item_value": "",
"item_type": "string",
"Item_desc": "Auth key sent with all Websocket frames for validation"
},
{
"id": 51,
"module": "general",
"item": "mailgunKey",
"item_value": "",
"item_type": "string",
"Item_desc": "MailGun API Key for notification"
},
{
"id": 52,
"module": "general",
"item": "mailgunURL",
"item_value": "",
"item_type": "string",
"Item_desc": "MailGun URL for notifications"
},
{
"id": 53,
"module": "general",
"item": "emailFrom",
"item_value": "",
"item_type": "string",
"Item_desc": "From address for the notification emails"
},
{
"id": 54,
"module": "pps",
"item": "enable",
"item_value": "false",
"item_type": "bool",
"Item_desc": "Enable PPS or not"
},
{
"id": 55,
"module": "pplns",
"item": "shareMulti",
"item_value": "2",
"item_type": "int",
"Item_desc": "Multiply this times difficulty to set the N in PPLNS"
},
{
"id": 56,
"module": "pplns",
"item": "shareMultiLog",
"item_value": "3",
"item_type": "int",
"Item_desc": "How many times the difficulty of the current block do we keep in shares before clearing them out"
},
{
"id": 57,
"module": "general",
"item": "blockCleaner",
"item_value": "true",
"item_type": "bool",
"Item_desc": "Enable the deletion of blocks or not."
},
{
"id": 58,
"module": "api",
"item": "secKey",
"item_value": "",
"item_type": "string",
"Item_desc": "HMAC key for Passwords. JWT Secret Key"
},
{
"id": 59,
"module": "payout",
"item": "feeSlewAmount",
"item_value": ".011",
"item_type": "float",
"Item_desc": "Amount to charge for the txn fee"
},
{
"id": 60,
"module": "payout",
"item": "feeSlewEnd",
"item_value": "4",
"item_type": "float",
"Item_desc": "Value at which txn fee amount drops to 0"
},
{
"id": 61,
"module": "general",
"item": "testnet",
"item_value": "false",
"item_type": "bool",
"Item_desc": "Does this pool use testnet?"
},
{
"id": 62,
"module": "pplns",
"item": "enable",
"item_value": "true",
"item_type": "bool",
"Item_desc": "Enable PPLNS on the pool."
},
{
"id": 63,
"module": "solo",
"item": "enable",
"item_value": "true",
"item_type": "bool",
"Item_desc": "Enable SOLO mining on the pool"
},
{
"id": 64,
"module": "general",
"item": "adminEmail",
"item_value": "",
"item_type": "string",
"Item_desc": "Admin e-mail to send e-mails to when something isn't working right."
},
{
"id": 65,
"module": "payout",
"item": "rpcPasswordEnabled",
"item_value": "false",
"item_type": "bool",
"Item_desc": "Does the wallet use a RPC password?"
},
{
"id": 66,
"module": "payout",
"item": "rpcPasswordPath",
"item_value": "",
"item_type": "string",
"Item_desc": "Path and file for the RPC password file location"
},
{
"id": 67,
"module": "payout",
"item": "maxPaymentTxns",
"item_value": "5",
"item_type": "int",
"Item_desc": "Maximum number of transactions in a single payment"
},
{
"id": 68,
"module": "general",
"item": "shareHost",
"item_value": "",
"item_type": "string",
"Item_desc": "Host that receives share information"
}
]

29
sql_sync/sql_sync.js Normal file
View file

@ -0,0 +1,29 @@
"use strict";
let mysql = require("promise-mysql");
let fs = require("fs");
let config = fs.readFileSync("../config.json");
let sql_schema = fs.readFileSync("config_entries.json");
global.config = JSON.parse(config);
global.mysql = mysql.createPool(global.config.mysql);
global.schema = JSON.parse(sql_schema);
// Config Table Layout
// <module>.<item>
let loopCount = 0;
let updatedCount = 0;
global.schema.forEach(function(entry){
loopCount += 1;
global.mysql.query("SELECT * FROM config WHERE module = ? AND item = ?", [entry.module, entry.item]).then(function(rows){
if (rows.length > 0){
return;
}
updatedCount += 1;
global.mysql.query("INSERT INTO config (module, item, item_value, item_type, Item_desc) VALUES (?, ?, ?, ?, ?)", [entry.module, entry.item, entry.item_value, entry.item_type, entry.Item_desc]);
if(loopCount === global.schema.length){
console.log("Updated SQL schema with "+updatedCount+" new rows! Exiting!");
process.exit();
}
});
});