0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

#144 Add fallback support to previous config files

This commit is contained in:
Juan Picado 2017-04-13 21:32:49 +02:00
parent 999abc5b73
commit 098675516b
No known key found for this signature in database
GPG key ID: 18AC54485952D158

View file

@ -13,7 +13,18 @@ module.exports.notify = function(metadata, config) {
body: content
}
if ( config.notify.headers ) {
// provides fallback support, it's accept an Object {} and Array of {}
if ( config.notify.headers && Array.isArray(config.notify.headers) ) {
var header = {};
config.notify.headers.map(function(item) {
if (Object.is(item, item)) {
for (var key in item) {
header[key] = item[key];
}
}
});
options.headers = header;
} else if (Object.is(config.notify.headers, config.notify.headers)) {
options.headers = config.notify.headers;
}