Skip to content

Commit

Permalink
Fix matching
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Oct 9, 2024
1 parent 55d5195 commit 355482e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/executor/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class DockerExecutor {
nginxChanged = true;
}
let proxyPass = matchedConf.proxy_pass + "";
let proxyPassMatched = exposedPorts.includes(parseInt(proxyPass.replace(/^docker:/, '')));
let proxyPassMatched = proxyPass.startsWith('docker:') && exposedPorts.includes(parseInt(proxyPass.replace(/^docker:/, '')));
var matchingProxy = proxyPass;
if (hint) {
matchingProxy = "docker:" + hint;
Expand All @@ -152,10 +152,10 @@ class DockerExecutor {
if (exposedPorts.length == 0) {
throw new Error("There are no exposed ports can be detected! Please tell use the port like `service: docker-compose.yml#8000`");
}
matchingProxy = exposedPorts[0] + '';
matchingProxy = "docker:" + exposedPorts[0];
}
if (matchingProxy != proxyPass) {
matchedConf.proxy_pass = "docker:" + exposedPorts[exposedPorts.length - 1];
matchedConf.proxy_pass = matchingProxy;
nginxChanged = true;
}
let nginxStatus = '';
Expand Down

0 comments on commit 355482e

Please sign in to comment.