Skip to content

Commit 5e5fb8e

Browse files
committed
[exoframe-server] Fix selection of containers by URL
1 parent 0564ad2 commit 5e5fb8e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/exoframe-server/src/routes/logs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ const getContainerLogs = async ({ username, id, reply, follow }) => {
4747

4848
// if not found by name - try to find by domain.
4949
const containerByUrl = allContainers.find((c) => {
50+
const ruleLabel = Object.keys(c.Labels).find((l) => l.includes('traefik.http.routers') && l.includes('.rule'));
5051
return (
51-
c.Labels['exoframe.user'] === username &&
52-
c.Labels[`traefik.http.routers.${c.Labels['exoframe.deployment']}.rule`].includes(id)
52+
c.Labels['exoframe.user'] === username && ruleLabel && c.Labels[ruleLabel] && c.Labels[ruleLabel].includes(id)
5353
);
5454
});
5555
if (containerByUrl) {

packages/exoframe-server/src/routes/remove.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const removeUserContainer = async ({ username, id, reply }) => {
1717

1818
// if not found by name - try to find by domain.
1919
const containerByUrl = allContainers.find((c) => {
20+
const ruleLabel = Object.keys(c.Labels).find((l) => l.includes('traefik.http.routers') && l.includes('.rule'));
2021
return (
21-
c.Labels['exoframe.user'] === username &&
22-
c.Labels[`traefik.http.routers.${c.Labels['exoframe.deployment']}.rule`].includes(id)
22+
c.Labels['exoframe.user'] === username && ruleLabel && c.Labels[ruleLabel] && c.Labels[ruleLabel].includes(id)
2323
);
2424
});
2525
if (containerByUrl) {

0 commit comments

Comments
 (0)