1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2025-06-27 00:51:30 +02:00

Fix and improve test docker host

This commit is contained in:
Louis Lam
2022-07-29 20:57:13 +08:00
parent 1062e629c5
commit f3322398e5
2 changed files with 35 additions and 9 deletions

View File

@ -1,6 +1,7 @@
const { sendDockerHostList } = require("../client");
const { checkLogin } = require("../util-server");
const { DockerHost } = require("../docker");
const { log } = require("../../src/util");
/**
* Handlers for docker hosts
@ -52,15 +53,22 @@ module.exports.dockerSocketHandler = (socket) => {
try {
checkLogin(socket);
let amount = await DockerHost.getAmountContainer(dockerHost);
let amount = await DockerHost.testDockerHost(dockerHost);
let msg;
if (amount > 1) {
msg = "Connected Successfully. Amount of containers: " + amount;
} else {
msg = "Connected Successfully, but there are no containers?";
}
callback({
ok: true,
msg: "Amount of containers: " + amount,
msg,
});
} catch (e) {
console.error(e);
log.error("docker", e);
callback({
ok: false,