Skip to content
Snippets Groups Projects
Unverified Commit cc109176 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

refactor: packagist auth (#3809)

parent d550d554
No related branches found
No related tags found
No related merge requests found
...@@ -13,14 +13,11 @@ module.exports = { ...@@ -13,14 +13,11 @@ module.exports = {
function getHostOpts(url) { function getHostOpts(url) {
const opts = { const opts = {
...hostRules.find({ hostType: 'packagist', url }),
json: true, json: true,
}; };
if (opts && opts.username && opts.password) { const { username, password } = hostRules.find({ hostType: 'packagist', url });
const auth = Buffer.from(`${opts.username}:${opts.password}`).toString( if (username && password) {
'base64' opts.auth = `${opts.username}:${opts.password}`;
);
opts.headers = { Authorization: `Basic ${auth}` };
} }
return opts; return opts;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment