Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
metrics: Default reporting metrics to default registry
Browse files Browse the repository at this point in the history
  • Loading branch information
iarna committed Feb 14, 2017
1 parent 892f531 commit 3ef75b0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/misc/npm-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ Any "%s" in the message will be replaced with the version number.

### metrics-registry

* Default: "https://registry.npmjs.org/"
* Default: The value of `registry` (which defaults to "https://registry.npmjs.org/")
* Type: String

The registry you want to send cli metrics to if `send-metrics` is true.
Expand Down
4 changes: 2 additions & 2 deletions lib/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Object.defineProperty(exports, 'defaults', {get: function () {
long: false,
maxsockets: 50,
message: '%s',
'metrics-registry': 'https://registry.npmjs.org/',
'metrics-registry': null,
'node-version': process.version,
'onload-script': false,
only: null,
Expand Down Expand Up @@ -288,7 +288,7 @@ exports.types = {
long: Boolean,
maxsockets: Number,
message: String,
'metrics-registry': String,
'metrics-registry': [null, String],
'node-version': [null, semver],
'onload-script': [null, String],
only: [null, 'dev', 'development', 'prod', 'production'],
Expand Down
4 changes: 4 additions & 0 deletions lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@
ua = ua.replace(/\{arch\}/gi, process.arch)
config.set('user-agent', ua)

if (config.get('metrics-registry') == null) {
config.set('metrics-registry', config.get('registry'))
}

var color = config.get('color')

log.level = config.get('loglevel')
Expand Down
1 change: 0 additions & 1 deletion test/tap/anon-cli-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var conf = {
npm_config_tmp: tmpdir,
npm_config_prefix: globaldir,
npm_config_registry: common.registry,
npm_config_metrics_registry: common.registry,
npm_config_loglevel: 'warn'
})
}
Expand Down

0 comments on commit 3ef75b0

Please sign in to comment.