#279 adding auth details for proxy

This commit is contained in:
Géza Molnár
2024-08-03 17:04:50 +02:00
committed by Slawomir Jaranowski
parent 45ea8e67c7
commit 06520eb502
3 changed files with 31 additions and 3 deletions

View File

@ -213,10 +213,10 @@ function fillProxies(template) {
return;
}
JSON.parse(proxies).forEach((proxy) => fillProxy(template, proxy.id, proxy.active, proxy.protocol, proxy.host, proxy.port, proxy.nonProxyHosts));
JSON.parse(proxies).forEach((proxy) => fillProxy(template, proxy.id, proxy.active, proxy.protocol, proxy.host, proxy.port, proxy.nonProxyHosts, proxy.user, proxy.password));
}
function fillProxy(template, id, active, protocol, host, port, nonProxyHosts) {
function fillProxy(template, id, active, protocol, host, port, nonProxyHosts, proxyUser, proxyPassword) {
if(!id || !active || !protocol || !host || !port || !nonProxyHosts) {
core.setFailed('proxies must contain id, active, protocol, host, port and nonProxyHosts');
return;
@ -230,6 +230,13 @@ function fillProxy(template, id, active, protocol, host, port, nonProxyHosts) {
proxyXml.getElementsByTagName("port")[0].textContent = port;
proxyXml.getElementsByTagName("nonProxyHosts")[0].textContent = nonProxyHosts;
if(proxyUser) {
jsonToXml(proxyXml, proxyXml.documentElement, {username: proxyUser});
}
if(proxyPassword) {
jsonToXml(proxyXml, proxyXml.documentElement, {password: proxyPassword});
}
const proxiesXml = template.getElementsByTagName('proxies')[0];
proxiesXml.appendChild(proxyXml);
}