add host param

This commit is contained in:
Matias Alejo Garcia 2015-02-17 20:31:03 -03:00
parent 1e3366617e
commit e2167640fb
16 changed files with 17 additions and 5 deletions

View File

@ -23,6 +23,7 @@ A Multisig HD Wallet Service, with minimun server trust.
./bit -c pete.dat status
export BIT_FILE=pete.dat
export BIT_HOST=http://pepe.com/bws
./bit address
[1bitcoinaddress]
./bit balance

View File

@ -17,6 +17,7 @@ program
.command('rm <txpId>', 'remove a transaction proposal')
.command('export', 'export wallet critical data')
.command('import', 'import wallet critical data')
.command('confirm', 'show copayer\'s data for confirmation')
.parse(process.argv);

View File

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
.parse(process.argv);

View File

@ -8,6 +8,7 @@ var Client = require('../lib/client');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
.parse(process.argv);

View File

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
.parse(process.argv);

View File

@ -8,6 +8,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v,--verbose', 'be verbose')
.usage('[options] <txpid>')
.parse(process.argv);

View File

@ -8,6 +8,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-t, --testnet', 'Create a Testnet Wallet', String)
.usage('[options] <walletName> <m-n> [copayerName]')
.parse(process.argv);

View File

@ -9,6 +9,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
.option('-q, --qr')
.parse(process.argv);

View File

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.usage('[options] <secret> [copayerName]')
.parse(process.argv);

View File

@ -9,6 +9,7 @@ program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
.option('-v,--verbose', 'be verbose')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.usage('[options] <txpid> [reason]')
.parse(process.argv);

View File

@ -9,6 +9,7 @@ program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
.option('-v,--verbose', 'be verbose')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.usage('[options] <txpid>')
.parse(process.argv);

View File

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
.usage('[options] <address> <amount> <message>')
.parse(process.argv);

View File

@ -8,6 +8,7 @@ program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
.option('-v,--verbose', 'be verbose')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.usage('[options] <txpid>')
.parse(process.argv);

View File

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
.parse(process.argv);

View File

@ -37,6 +37,7 @@ Utils.getClient = function(args) {
});
return new Client({
storage: storage,
baseUrl: args.host || process.env['BIT_HOST'],
verbose: args.verbose
});
}

View File

@ -23,10 +23,6 @@ function _createProposalOpts(opts, signingKey) {
return opts;
};
function _getUrl(path) {
return BASE_URL + path;
};
function _parseError(body) {
if (_.isString(body)) {
try {
@ -58,6 +54,7 @@ function API(opts) {
this.storage = opts.storage;
this.verbose = !!opts.verbose;
this.request = request || opts.request;
this.baseUrl = opts.baseUrl || BASE_URL;
if (this.verbose) {
log.level = 'debug';
}
@ -112,7 +109,7 @@ API.prototype._doRequest = function(method, url, args, data, cb) {
if (data.signingPrivKey)
reqSignature = _signRequest(method, url, args, data.signingPrivKey);
var absUrl = _getUrl(url);
var absUrl = this.baseUrl + url;
var args = {
headers: {
'x-identity': data.copayerId,