Delete old config.js
This commit is contained in:
parent
abaebc9918
commit
9c8549af07
109
config.js
109
config.js
@ -1,109 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var path = require('path');
|
|
||||||
var fs = require('fs');
|
|
||||||
var mkdirp = require('mkdirp');
|
|
||||||
|
|
||||||
var rootPath = path.normalize(__dirname),
|
|
||||||
env,
|
|
||||||
db,
|
|
||||||
port,
|
|
||||||
b_port,
|
|
||||||
p2p_port;
|
|
||||||
|
|
||||||
var packageStr = fs.readFileSync(rootPath + '/package.json');
|
|
||||||
var version = JSON.parse(packageStr).version;
|
|
||||||
|
|
||||||
|
|
||||||
function getUserHome() {
|
|
||||||
return process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
|
|
||||||
}
|
|
||||||
|
|
||||||
var home = process.env.BLOCKCHAIN_API_DB || (getUserHome() + '/.bitcore-node');
|
|
||||||
|
|
||||||
if (process.env.BLOCKCHAIN_API_NETWORK === 'livenet') {
|
|
||||||
env = 'livenet';
|
|
||||||
db = home;
|
|
||||||
port = '3000';
|
|
||||||
b_port = '8332';
|
|
||||||
p2p_port = '8333';
|
|
||||||
} else {
|
|
||||||
env = 'testnet';
|
|
||||||
db = home + '/testnet';
|
|
||||||
port = '3001';
|
|
||||||
b_port = '18332';
|
|
||||||
p2p_port = '18333';
|
|
||||||
}
|
|
||||||
port = parseInt(process.env.BLOCKCHAIN_API_PORT) || port;
|
|
||||||
|
|
||||||
|
|
||||||
switch (process.env.NODE_ENV) {
|
|
||||||
case 'production':
|
|
||||||
env += '';
|
|
||||||
break;
|
|
||||||
case 'test':
|
|
||||||
env += ' - test environment';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
env += ' - development';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var network = process.env.BLOCKCHAIN_API_NETWORK || 'testnet';
|
|
||||||
|
|
||||||
var dataDir = process.env.BITCOIND_DATADIR;
|
|
||||||
var isWin = /^win/.test(process.platform);
|
|
||||||
var isMac = /^darwin/.test(process.platform);
|
|
||||||
var isLinux = /^linux/.test(process.platform);
|
|
||||||
if (!dataDir) {
|
|
||||||
if (isWin) dataDir = '%APPDATA%\\Bitcoin\\';
|
|
||||||
if (isMac) dataDir = process.env.HOME + '/Library/Application Support/Bitcoin/';
|
|
||||||
if (isLinux) dataDir = process.env.HOME + '/.bitcoin/';
|
|
||||||
}
|
|
||||||
dataDir += network === 'testnet' ? 'testnet3' : '';
|
|
||||||
|
|
||||||
var safeConfirmations = process.env.BLOCKCHAIN_API_SAFE_CONFIRMATIONS || 6;
|
|
||||||
var ignoreCache = process.env.BLOCKCHAIN_API_IGNORE_CACHE || 0;
|
|
||||||
|
|
||||||
|
|
||||||
var bitcoindConf = {
|
|
||||||
protocol: process.env.BITCOIND_PROTO || 'http',
|
|
||||||
user: process.env.BITCOIND_USER || 'user',
|
|
||||||
pass: process.env.BITCOIND_PASS || 'pass',
|
|
||||||
host: process.env.BITCOIND_HOST || '127.0.0.1',
|
|
||||||
port: process.env.BITCOIND_PORT || b_port,
|
|
||||||
p2pPort: process.env.BITCOIND_P2P_PORT || p2p_port,
|
|
||||||
p2pHost: process.env.BITCOIND_P2P_HOST || process.env.BITCOIND_HOST || '127.0.0.1',
|
|
||||||
dataDir: dataDir,
|
|
||||||
// DO NOT CHANGE THIS!
|
|
||||||
disableAgent: true
|
|
||||||
};
|
|
||||||
|
|
||||||
var loggerLevel = process.env.LOGGER_LEVEL || 'info';
|
|
||||||
var enableHTTPS = process.env.ENABLE_HTTPS === 'true';
|
|
||||||
|
|
||||||
if (!fs.existsSync(db)) {
|
|
||||||
mkdirp.sync(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
loggerLevel: loggerLevel,
|
|
||||||
enableHTTPS: enableHTTPS,
|
|
||||||
version: version,
|
|
||||||
root: rootPath,
|
|
||||||
publicPath: process.env.BLOCKCHAIN_API_PUBLIC_PATH || false,
|
|
||||||
apiPrefix: '/api',
|
|
||||||
port: port,
|
|
||||||
leveldb: db,
|
|
||||||
bitcoind: bitcoindConf,
|
|
||||||
network: network,
|
|
||||||
disableP2pSync: false,
|
|
||||||
disableHistoricSync: false,
|
|
||||||
poolMatchFile: rootPath + '/etc/minersPoolStrings.json',
|
|
||||||
|
|
||||||
keys: {
|
|
||||||
segmentio: process.env.BLOCKCHAIN_API_SEGMENTIO_KEY
|
|
||||||
},
|
|
||||||
safeConfirmations: safeConfirmations, // PLEASE NOTE THAT *FULL RESYNC* IS NEEDED TO CHANGE safeConfirmations
|
|
||||||
ignoreCache: ignoreCache,
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue
Block a user