remove name field from node
This commit is contained in:
parent
900f715a49
commit
7ac429fbd2
@ -50,12 +50,11 @@ function createBitcoinDirectory(datadir, done) {
|
|||||||
/**
|
/**
|
||||||
* Will create a base Bitcore Node configuration directory and files.
|
* Will create a base Bitcore Node configuration directory and files.
|
||||||
* @param {String} configDir - The absolute path
|
* @param {String} configDir - The absolute path
|
||||||
* @param {String} name - The name of the node
|
|
||||||
* @param {String} datadir - The bitcoin database directory
|
* @param {String} datadir - The bitcoin database directory
|
||||||
* @param {Boolean} isGlobal - If the configuration depends on globally installed node services.
|
* @param {Boolean} isGlobal - If the configuration depends on globally installed node services.
|
||||||
* @param {Function} done - The callback function called when finished
|
* @param {Function} done - The callback function called when finished
|
||||||
*/
|
*/
|
||||||
function createConfigDirectory(configDir, name, datadir, isGlobal, done) {
|
function createConfigDirectory(configDir, datadir, isGlobal, done) {
|
||||||
mkdirp(configDir, function(err) {
|
mkdirp(configDir, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
@ -64,7 +63,6 @@ function createConfigDirectory(configDir, name, datadir, isGlobal, done) {
|
|||||||
var configInfo = defaultConfig();
|
var configInfo = defaultConfig();
|
||||||
var config = configInfo.config;
|
var config = configInfo.config;
|
||||||
|
|
||||||
config.name = name || 'Bitcore Node';
|
|
||||||
config.datadir = datadir;
|
config.datadir = datadir;
|
||||||
var configJSON = JSON.stringify(config, null, 2);
|
var configJSON = JSON.stringify(config, null, 2);
|
||||||
var packageJSON = JSON.stringify(BASE_PACKAGE, null, 2);
|
var packageJSON = JSON.stringify(BASE_PACKAGE, null, 2);
|
||||||
@ -88,7 +86,6 @@ function createConfigDirectory(configDir, name, datadir, isGlobal, done) {
|
|||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
* @param {String} options.cwd - The current working directory
|
* @param {String} options.cwd - The current working directory
|
||||||
* @param {String} options.dirname - The name of the bitcore node configuration directory
|
* @param {String} options.dirname - The name of the bitcore node configuration directory
|
||||||
* @param {String} options.name - The name of the bitcore node
|
|
||||||
* @param {String} options.datadir - The path to the bitcoin datadir
|
* @param {String} options.datadir - The path to the bitcoin datadir
|
||||||
* @param {Function} done - A callback function called when finished
|
* @param {Function} done - A callback function called when finished
|
||||||
*/
|
*/
|
||||||
@ -99,13 +96,11 @@ function create(options, done) {
|
|||||||
$.checkArgument(_.isFunction(done));
|
$.checkArgument(_.isFunction(done));
|
||||||
$.checkArgument(_.isString(options.cwd));
|
$.checkArgument(_.isString(options.cwd));
|
||||||
$.checkArgument(_.isString(options.dirname));
|
$.checkArgument(_.isString(options.dirname));
|
||||||
$.checkArgument(_.isString(options.name) || _.isUndefined(options.name));
|
|
||||||
$.checkArgument(_.isBoolean(options.isGlobal));
|
$.checkArgument(_.isBoolean(options.isGlobal));
|
||||||
$.checkArgument(_.isString(options.datadir));
|
$.checkArgument(_.isString(options.datadir));
|
||||||
|
|
||||||
var cwd = options.cwd;
|
var cwd = options.cwd;
|
||||||
var dirname = options.dirname;
|
var dirname = options.dirname;
|
||||||
var name = options.name;
|
|
||||||
var datadir = options.datadir;
|
var datadir = options.datadir;
|
||||||
var isGlobal = options.isGlobal;
|
var isGlobal = options.isGlobal;
|
||||||
|
|
||||||
@ -116,7 +111,7 @@ function create(options, done) {
|
|||||||
function(next) {
|
function(next) {
|
||||||
// Setup the the bitcore-node directory and configuration
|
// Setup the the bitcore-node directory and configuration
|
||||||
if (!fs.existsSync(absConfigDir)) {
|
if (!fs.existsSync(absConfigDir)) {
|
||||||
createConfigDirectory(absConfigDir, name, datadir, isGlobal, next);
|
createConfigDirectory(absConfigDir, datadir, isGlobal, next);
|
||||||
} else {
|
} else {
|
||||||
next(new Error('Directory "' + absConfigDir+ '" already exists.'));
|
next(new Error('Directory "' + absConfigDir+ '" already exists.'));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ function getDefaultConfig() {
|
|||||||
return {
|
return {
|
||||||
path: process.cwd(),
|
path: process.cwd(),
|
||||||
config: {
|
config: {
|
||||||
name: 'Bitcore Node',
|
|
||||||
datadir: process.env.BITCORENODE_DIR || path.resolve(process.env.HOME, '.bitcoin'),
|
datadir: process.env.BITCORENODE_DIR || path.resolve(process.env.HOME, '.bitcoin'),
|
||||||
network: process.env.BITCORENODE_NETWORK || 'livenet',
|
network: process.env.BITCORENODE_NETWORK || 'livenet',
|
||||||
port: Number(process.env.BITCORENODE_PORT) || 3001,
|
port: Number(process.env.BITCORENODE_PORT) || 3001,
|
||||||
|
|||||||
@ -74,7 +74,6 @@ describe('#create', function() {
|
|||||||
should.equal(fs.existsSync(bitcoinConfig), true);
|
should.equal(fs.existsSync(bitcoinConfig), true);
|
||||||
|
|
||||||
var config = JSON.parse(fs.readFileSync(configPath));
|
var config = JSON.parse(fs.readFileSync(configPath));
|
||||||
config.name.should.equal('My Node 1');
|
|
||||||
config.services.should.deep.equal(['bitcoind', 'db', 'address', 'web']);
|
config.services.should.deep.equal(['bitcoind', 'db', 'address', 'web']);
|
||||||
config.datadir.should.equal('./data');
|
config.datadir.should.equal('./data');
|
||||||
config.network.should.equal('livenet');
|
config.network.should.equal('livenet');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user