add report when starting insight
This commit is contained in:
parent
09baa94a8b
commit
1636e84bbe
|
@ -9,6 +9,9 @@ var path = require('path'),
|
|||
b_port,
|
||||
p2p_port;
|
||||
|
||||
var packageStr = fs.readFileSync('package.json');
|
||||
var version = JSON.parse(packageStr).version;
|
||||
|
||||
|
||||
function getUserHome() {
|
||||
return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
|
||||
|
@ -55,8 +58,54 @@ if (!dataDir) {
|
|||
if (isMac) dataDir = process.env.HOME + '/Library/Application Support/Bitcoin/';
|
||||
if (isLinux) dataDir = process.env.HOME + '/.bitcoin/';
|
||||
}
|
||||
var odataDir = dataDir;
|
||||
|
||||
dataDir += network === 'testnet' ? 'testnet3' : '';
|
||||
|
||||
var safeConfirmations = process.env.SAFE_CONFIRMATIONS || 6;
|
||||
|
||||
|
||||
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,
|
||||
dataDir: dataDir,
|
||||
// DO NOT CHANGE THIS!
|
||||
disableAgent: true
|
||||
};
|
||||
|
||||
/*jshint multistr: true */
|
||||
console.log(
|
||||
'\n Insight API v%s\n\
|
||||
\n # Configuration:\n\
|
||||
\t\tNetwork: %s\tINSIGHT_NETWORK\n\
|
||||
\t\tDatabase Path: %s\tINSIGHT_DB\n\
|
||||
\t\tSafe Confirmations: %s\tSAFE_CONFIRMATIONS\n\
|
||||
# Bicoind Connection configuration:\n\
|
||||
\t\tRPC Username: %s\tBITCOIND_USER\n\
|
||||
\t\tRPC Password: %s\tBITCOIND_PASS\n\
|
||||
\t\tRPC Protocol: %s\tBITCOIND_PROTO\n\
|
||||
\t\tRPC Host: %s\tBITCOIND_HOST\n\
|
||||
\t\tRPC Port: %s\tBITCOIND_PORT\n\
|
||||
\t\tP2P Port: %s\tBITCOIND_P2P_PORT\n\
|
||||
\t\tData Dir: %s\tBITCOIND_DATADIR\n\
|
||||
\nChange setting by assigning the enviroment variables in the last column. Example:\n\
|
||||
$ INSIGHT_NETWORK="testnet" BITCOIND_HOST="123.123.123.123" ./insight.js\
|
||||
\n\n',
|
||||
version,
|
||||
network, home, safeConfirmations,
|
||||
bitcoindConf.user,
|
||||
bitcoindConf.pass?'Yes(hidden)':'No',
|
||||
bitcoindConf.protocol,
|
||||
bitcoindConf.host,
|
||||
bitcoindConf.port,
|
||||
bitcoindConf.p2p_port,
|
||||
odataDir
|
||||
);
|
||||
|
||||
|
||||
if (! fs.existsSync(db)){
|
||||
|
||||
|
@ -71,17 +120,7 @@ module.exports = {
|
|||
apiPrefix: '/api',
|
||||
port: port,
|
||||
leveldb: db,
|
||||
bitcoind: {
|
||||
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,
|
||||
dataDir: dataDir,
|
||||
// DO NOT CHANGE THIS!
|
||||
disableAgent: true
|
||||
},
|
||||
bitcoind: bitcoindConf,
|
||||
network: network,
|
||||
disableP2pSync: false,
|
||||
disableHistoricSync: false,
|
||||
|
@ -92,5 +131,5 @@ module.exports = {
|
|||
keys: {
|
||||
segmentio: process.env.INSIGHT_SEGMENTIO_KEY
|
||||
},
|
||||
safeConfirmations: 6, // PLEASE NOTE THAT *FULL RESYNC* IS NEEDED TO CHANGE safeConfirmations
|
||||
safeConfirmations: safeConfirmations, // PLEASE NOTE THAT *FULL RESYNC* IS NEEDED TO CHANGE safeConfirmations
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
//Set the node enviornment variable if not set before
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
|
|
Loading…
Reference in New Issue