Skip to content

Commit

Permalink
Merge pull request #155 from verdaccio/notify-issue-144
Browse files Browse the repository at this point in the history
#144 Add fallback support to previous config files
  • Loading branch information
juanpicado committed Apr 13, 2017
2 parents 9350963 0986755 commit ee99d1f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ee99d1f

Please sign in to comment.