move DB out of insight directory
This commit is contained in:
parent
fb712091b5
commit
a4eda61659
|
@ -99,7 +99,8 @@ If bitcoind is shutdown, *insight* needs to be stopped and restarted once bitcoi
|
|||
### DB storage requirement
|
||||
|
||||
To store the blockchain and address related information, *insight* uses LevelDB. Two DBs are created: txs and blocks. By default these are stored on
|
||||
```<insight root>/db```
|
||||
```<user's home>/db```
|
||||
Please note that previous version's of Insight-API store that on `<insight's root>/db`
|
||||
|
||||
this can be changed on config/config.js. As of February 2014, storing the livenet blockchain takes ~30GB of disk space (2GB for the testnet).
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
rootPath = path.normalize(__dirname + '/..'),
|
||||
env,
|
||||
db,
|
||||
|
@ -8,16 +9,23 @@ var path = require('path'),
|
|||
b_port,
|
||||
p2p_port;
|
||||
|
||||
|
||||
function getUserHome() {
|
||||
return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
|
||||
}
|
||||
|
||||
var home = process.env.INSIGHT_DB || ( getUserHome() + '/insight-api-db' );
|
||||
|
||||
if (process.env.INSIGHT_NETWORK === 'livenet') {
|
||||
env = 'livenet';
|
||||
db = rootPath + '/db';
|
||||
db = home;
|
||||
port = '3000';
|
||||
b_port = '8332';
|
||||
p2p_port = '8333';
|
||||
}
|
||||
else {
|
||||
env = 'testnet';
|
||||
db = rootPath + '/db/testnet';
|
||||
db = home + '/testnet';
|
||||
port = '3001';
|
||||
b_port = '18332';
|
||||
p2p_port = '18333';
|
||||
|
@ -48,6 +56,13 @@ if (!dataDir) {
|
|||
}
|
||||
dataDir += network === 'testnet' ? 'testnet3' : '';
|
||||
|
||||
|
||||
if (! fs.existsSync(db)){
|
||||
|
||||
console.log('## ERROR ##\n\tDB Directory "%s" not found. \n\tCreate it, move your old DB there or set the INSIGHT_DB environment variable.\n\tNOTE: In older insight-api versions, db was stored at <insight-root>/db', db);
|
||||
process.exit(-1);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
root: rootPath,
|
||||
publicPath: process.env.INSIGHT_PUBLIC_PATH || false,
|
||||
|
|
|
@ -30,6 +30,8 @@ var Rpc = imports.rpc || require('./Rpc'),
|
|||
async = require('async'),
|
||||
config = require('../config/config'),
|
||||
assert = require('assert');
|
||||
|
||||
|
||||
var db = imports.db || levelup(config.leveldb + '/txs',{maxOpenFiles: MAX_OPEN_FILES} );
|
||||
var Script = require('bitcore/Script');
|
||||
// This is 0.1.2 = > c++ version of base57-native
|
||||
|
|
Loading…
Reference in New Issue