Skip to content

Commit 01cad68

Browse files
committed
[exoframe-server] Fix container lookup by domain for logs order
1 parent ab8938c commit 01cad68

File tree

1 file changed

+9
-9
lines changed
  • packages/exoframe-server/src/routes

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,6 @@ const getContainerLogs = async ({ username, id, reply, follow }) => {
4545
return reply.send(logStream);
4646
}
4747

48-
// if not found by name - try to find by project
49-
const containers = allContainers.filter(
50-
(c) => c.Labels['exoframe.user'] === username && c.Labels['exoframe.project'] === id
51-
);
52-
if (!containers.length) {
53-
reply.code(404).send({ error: 'Container not found!' });
54-
return;
55-
}
56-
5748
// if not found by name - try to find by domain.
5849
const containerByUrl = allContainers.find((c) => {
5950
return (
@@ -68,6 +59,15 @@ const getContainerLogs = async ({ username, id, reply, follow }) => {
6859
return reply.send(logStream);
6960
}
7061

62+
// if not found by name - try to find by project
63+
const containers = allContainers.filter(
64+
(c) => c.Labels['exoframe.user'] === username && c.Labels['exoframe.project'] === id
65+
);
66+
if (!containers.length) {
67+
reply.code(404).send({ error: 'Container not found!' });
68+
return;
69+
}
70+
7171
// get all log streams and prepend them with service names
7272
const logRequests = await Promise.all(
7373
containers.map(async (cInfo) => {

0 commit comments

Comments
 (0)