mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Also load custom CA file for "default"
This commit is contained in:
@@ -54,16 +54,18 @@ function loadCAs(caConfig) {
|
||||
// If a ca file path has been specified, expand that here to the file's
|
||||
// contents. As a user can specify these individually, we must load them
|
||||
// one by one.
|
||||
if (caConfig.search) {
|
||||
caConfig.search = caConfig.search.map(function(s) {
|
||||
return readCertFile(s);
|
||||
});
|
||||
}
|
||||
['register', 'publish'].forEach(function(p) {
|
||||
if (caConfig[p]) {
|
||||
caConfig[p] = readCertFile(caConfig[p]);
|
||||
for (var p in caConfig) {
|
||||
if (caConfig.hasOwnProperty(p)) {
|
||||
var prop = caConfig[p];
|
||||
if (Array.isArray(prop)) {
|
||||
caConfig[p] = prop.map(function(s) {
|
||||
return readCertFile(s);
|
||||
});
|
||||
} else if (prop) {
|
||||
caConfig[p] = readCertFile(prop);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Config.prototype.toObject = function () {
|
||||
|
||||
@@ -120,7 +120,7 @@ describe('NPM Config on package.json', function () {
|
||||
var config = require('../lib/Config')
|
||||
.read(path.resolve('test/assets/custom-ca'));
|
||||
|
||||
['register', 'publish'].forEach(function (p) {
|
||||
['register', 'publish', 'default'].forEach(function (p) {
|
||||
assertCAContents(config.ca[p], 'config.ca.' + p);
|
||||
});
|
||||
|
||||
@@ -136,7 +136,7 @@ describe('NPM Config on package.json', function () {
|
||||
var config = require('../lib/Config')
|
||||
.read(path.resolve('test/assets/custom-ca-embed'));
|
||||
|
||||
['register', 'publish'].forEach(function (p) {
|
||||
['register', 'publish', 'default'].forEach(function (p) {
|
||||
assertCAContents(config.ca[p], 'config.ca.' + p);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user