Potentially fixes #1

This commit is contained in:
Neshura 2022-12-10 03:12:08 +01:00
parent 6af8cb3e1b
commit 8426640271
No known key found for this signature in database
GPG key ID: ACDF5B6EBECF6B0A

View file

@ -111,15 +111,16 @@ function getStatus(containers: Dockerode.ContainerInfo[], entry: Service) {
else if (entry.type === "docker") { else if (entry.type === "docker") {
entry.status = ServiceStatus.offline; entry.status = ServiceStatus.offline;
// Loop over every found container and compare to the entry provided // Loop over every found container and compare to the entry provided
containers.forEach((element: Dockerode.ContainerInfo) => { containers.forEach((container: Dockerode.ContainerInfo) => {
element.Names.forEach((containerName: string) => { console.log(container)
if (containerName.startsWith("/")) { if (container.Names.includes("/" + entry.docker_container_name) || container.Names.includes(entry.docker_container_name)) {
containerName = containerName.substring(1); if (container.State === "running") {
}
if (containerName === entry.docker_container_name) {
entry.status = ServiceStatus.online; entry.status = ServiceStatus.online;
} }
}); else {
entry.status = ServiceStatus.offline;
}
}
if (entry.docker_container_name == null) { if (entry.docker_container_name == null) {
console.log("MISSING DOCKER CONTAINER NAME FOR " + entry.name); console.log("MISSING DOCKER CONTAINER NAME FOR " + entry.name);
entry.status = ServiceStatus.error; entry.status = ServiceStatus.error;