scaffold: detect incompatible config
This commit is contained in:
parent
019bc2a58c
commit
3e2492e6d4
@ -201,6 +201,15 @@ function start(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fullConfig.path = path.resolve(options.path, './bitcore-node.json');
|
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);
|
fullConfig.services = start.setupServices(require, servicesPath, options.config);
|
||||||
|
|
||||||
var node = new BitcoreNode(fullConfig);
|
var node = new BitcoreNode(fullConfig);
|
||||||
|
|||||||
@ -15,7 +15,11 @@ describe('#start', function() {
|
|||||||
options.services[0].should.deep.equal({
|
options.services[0].should.deep.equal({
|
||||||
name: 'bitcoind',
|
name: 'bitcoind',
|
||||||
module: BitcoinService,
|
module: BitcoinService,
|
||||||
config: {}
|
config: {
|
||||||
|
spawn: {
|
||||||
|
datadir: './data'
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
TestNode.prototype.start = sinon.stub().callsArg(0);
|
TestNode.prototype.start = sinon.stub().callsArg(0);
|
||||||
@ -36,7 +40,13 @@ describe('#start', function() {
|
|||||||
services: [
|
services: [
|
||||||
'bitcoind'
|
'bitcoind'
|
||||||
],
|
],
|
||||||
datadir: './data'
|
servicesConfig: {
|
||||||
|
bitcoind: {
|
||||||
|
spawn: {
|
||||||
|
datadir: './data'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
node.should.be.instanceof(TestNode);
|
node.should.be.instanceof(TestNode);
|
||||||
@ -59,7 +69,7 @@ describe('#start', function() {
|
|||||||
path: __dirname,
|
path: __dirname,
|
||||||
config: {
|
config: {
|
||||||
services: [],
|
services: [],
|
||||||
datadir: './testdir'
|
servicesConfig: {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setImmediate(function() {
|
setImmediate(function() {
|
||||||
@ -74,7 +84,10 @@ describe('#start', function() {
|
|||||||
name: 'bitcoind',
|
name: 'bitcoind',
|
||||||
module: BitcoinService,
|
module: BitcoinService,
|
||||||
config: {
|
config: {
|
||||||
param: 'test'
|
param: 'test',
|
||||||
|
spawn: {
|
||||||
|
datadir: './data'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -97,10 +110,13 @@ describe('#start', function() {
|
|||||||
],
|
],
|
||||||
servicesConfig: {
|
servicesConfig: {
|
||||||
'bitcoind': {
|
'bitcoind': {
|
||||||
param: 'test'
|
param: 'test',
|
||||||
|
spawn: {
|
||||||
|
datadir: './data'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
datadir: './data'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
node.should.be.instanceof(TestNode);
|
node.should.be.instanceof(TestNode);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user