@cloudant/couchbackup
Advanced tools
Comparing version 2.3.2-SNAPSHOT.157 to 2.3.2-SNAPSHOT.158
@@ -87,2 +87,6 @@ // Copyright © 2017, 2018 IBM Corp. All rights reserved. | ||
} | ||
if (opts && typeof opts.requestTimeout !== 'undefined' && !isSafePositiveInteger(opts.requestTimeout)) { | ||
cb(new error.BackupError('InvalidOption', 'Invalid request timeout option, must be a positive integer in the range (0, MAX_SAFE_INTEGER]'), null); | ||
return; | ||
} | ||
if (opts && typeof opts.resume !== 'undefined' && typeof opts.resume !== 'boolean') { | ||
@@ -178,2 +182,3 @@ cb(new error.BackupError('InvalidOption', 'Invalid resume option, must be type boolean'), null); | ||
* @param {number} [opts.bufferSize=500] - Number of documents per batch request. | ||
* @param {number} [opts.requestTimeout=120000] - Milliseconds to wait before retrying a HTTP request. | ||
* @param {string} [opts.iamApiKey] - IAM API key to use to access Cloudant database. | ||
@@ -300,2 +305,3 @@ * @param {string} [opts.log] - Log file name. Default uses a temporary file. | ||
* @param {number} opts.bufferSize - Number of documents per batch request. Default 500. | ||
* @param {number} opts.requestTimeout - Milliseconds to wait before retrying a HTTP request. Default 120000. | ||
* @param {string} opts.iamApiKey - IAM API key to use to access Cloudant database. | ||
@@ -302,0 +308,0 @@ * @param {backupRestoreCallback} callback - Called on completion. |
@@ -33,2 +33,3 @@ #!/usr/bin/env node | ||
parallelism: program.parallelism, | ||
requestTimeout: program.requestTimeout, | ||
resume: program.resume, | ||
@@ -35,0 +36,0 @@ iamApiKey: program.iamApiKey, |
@@ -29,2 +29,3 @@ #!/usr/bin/env node | ||
parallelism: program.parallelism, | ||
requestTimeout: program.requestTimeout, | ||
iamApiKey: program.iamApiKey, | ||
@@ -31,0 +32,0 @@ iamTokenUrl: program.iamTokenUrl |
@@ -0,1 +1,7 @@ | ||
# 2.4.0 | ||
- [NEW] Added request timeout option. Set via env var `COUCH_REQUEST_TIMEOUT`, | ||
as CLI option `--request-timeout`, or programmatically via | ||
`options.requestTimeout` | ||
# 2.3.1 (2018-06-15) | ||
@@ -2,0 +8,0 @@ |
@@ -26,2 +26,3 @@ // Copyright © 2017, 2018 IBM Corp. All rights reserved. | ||
bufferSize: 500, | ||
requestTimeout: 120000, | ||
log: tmp.fileSync().name, | ||
@@ -70,2 +71,7 @@ resume: false, | ||
// if we have a specified request timeout | ||
if (typeof process.env.COUCH_REQUEST_TIMEOUT !== 'undefined') { | ||
opts.requestTimeout = parseInt(process.env.COUCH_REQUEST_TIMEOUT); | ||
} | ||
// if we have a specified log file | ||
@@ -72,0 +78,0 @@ if (typeof process.env.COUCH_LOG !== 'undefined') { |
@@ -56,2 +56,5 @@ // Copyright © 2017, 2018 IBM Corp. All rights reserved. | ||
defaults.resume) | ||
.option('-t, --request-timeout <n>', | ||
cliutils.getUsage('milliseconds to wait for a response to a HTTP request before retrying the request', defaults.requestTimeout), | ||
Number, defaults.requestTimeout) | ||
.option('-u, --url <url>', | ||
@@ -96,2 +99,5 @@ cliutils.getUsage('URL of the CouchDB/Cloudant server', defaults.url), | ||
Number, defaults.parallelism) | ||
.option('-t, --request-timeout <n>', | ||
cliutils.getUsage('milliseconds to wait for a response to a HTTP request before retrying the request', defaults.requestTimeout), | ||
Number, defaults.requestTimeout) | ||
.option('-u, --url <url>', | ||
@@ -98,0 +104,0 @@ cliutils.getUsage('URL of the CouchDB/Cloudant server', defaults.url), |
@@ -52,5 +52,6 @@ // Copyright © 2017, 2018 IBM Corp. All rights reserved. | ||
headers: { 'User-Agent': userAgent }, | ||
gzip: true | ||
gzip: true, | ||
timeout: opts.requestTimeout | ||
} }).use(dbName); | ||
} | ||
}; |
{ | ||
"name": "@cloudant/couchbackup", | ||
"version": "2.3.2-SNAPSHOT.157", | ||
"version": "2.3.2-SNAPSHOT.158", | ||
"description": "CouchBackup - command-line backup utility for Cloudant/CouchDB", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/cloudant/couchbackup", |
@@ -191,2 +191,3 @@ # CouchBackup | ||
* `COUCH_BUFFER_SIZE` - the number of documents fetched and restored at once e.g. `100` (default `500`) | ||
* `COUCH_REQUEST_TIMEOUT` - the number of milliseconds to wait for a respose to a HTTP request before retrying the request e.g. `10000` (Default `120000`) | ||
* `COUCH_LOG` - the file to store logging information during backup | ||
@@ -211,2 +212,3 @@ * `COUCH_RESUME` - if `true`, resumes a previous backup from its last known position | ||
* `--buffer-size` - same as `COUCH_BUFFER_SIZE` | ||
* `--request-timeout` - same as `COUCH_REQUEST_TIMEOUT` | ||
* `--log` - same as `COUCH_LOG` | ||
@@ -253,2 +255,3 @@ * `--resume` - same as `COUCH_RESUME` | ||
* `bufferSize`: see `COUCH_BUFFER_SIZE`. | ||
* `requestTimeout`: see `COUCH_REQUEST_TIMEOUT`. | ||
* `log`: see `COUCH_LOG`. | ||
@@ -318,2 +321,3 @@ * `resume`: see `COUCH_RESUME`. | ||
* `bufferSize`: see `COUCH_BUFFER_SIZE`. | ||
* `requestTimeout`: see `COUCH_REQUEST_TIMEOUT`. | ||
* `iamApiKey`: see `CLOUDANT_IAM_API_KEY`. | ||
@@ -320,0 +324,0 @@ * `iamTokenUrl`: may be used with `iamApiKey` to override the default URL for |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95678
1681
420
29