scaffold: detect incompatible config

This commit is contained in:
Braydon Fuller 2016-04-20 11:55:45 -04:00
parent 019bc2a58c
commit 3e2492e6d4
2 changed files with 31 additions and 6 deletions

View File

@ -201,6 +201,15 @@ function start(options) {
}
fullConfig.path = path.resolve(options.path, './bitcore-node.json');
if (fullConfig.datadir) {
throw new TypeError(
'Configuration file (' + fullConfig.path + ') is not compatible with this version.' +
' Please see https://github.com/bitpay/bitcore-node/blob/bitcoind/docs/upgrade.md' +
' for upgrade details.'
);
}
fullConfig.services = start.setupServices(require, servicesPath, options.config);
var node = new BitcoreNode(fullConfig);

View File

@ -15,7 +15,11 @@ describe('#start', function() {
options.services[0].should.deep.equal({
name: 'bitcoind',
module: BitcoinService,
config: {}
config: {
spawn: {
datadir: './data'
}
}
});
};
TestNode.prototype.start = sinon.stub().callsArg(0);
@ -36,7 +40,13 @@ describe('#start', function() {
services: [
'bitcoind'
],
datadir: './data'
servicesConfig: {
bitcoind: {
spawn: {
datadir: './data'
}
}
}
}
});
node.should.be.instanceof(TestNode);
@ -59,7 +69,7 @@ describe('#start', function() {
path: __dirname,
config: {
services: [],
datadir: './testdir'
servicesConfig: {}
}
});
setImmediate(function() {
@ -74,7 +84,10 @@ describe('#start', function() {
name: 'bitcoind',
module: BitcoinService,
config: {
param: 'test'
param: 'test',
spawn: {
datadir: './data'
}
}
});
};
@ -97,10 +110,13 @@ describe('#start', function() {
],
servicesConfig: {
'bitcoind': {
param: 'test'
param: 'test',
spawn: {
datadir: './data'
}
}
},
datadir: './data'
}
});
node.should.be.instanceof(TestNode);