Add ability to connect to daemon via http / tcp for windows compatibility

This commit is contained in:
c0derMo
2022-01-22 01:57:37 +00:00
parent 4818bb67d6
commit 29df70949d
5 changed files with 29 additions and 1 deletions

View File

@@ -79,6 +79,7 @@ class Monitor extends BeanModel {
pushToken: this.pushToken,
docker_container: this.docker_container,
docker_daemon: this.docker_daemon,
docker_type: this.docker_type,
notificationIDList,
tags: tags,
};
@@ -358,13 +359,18 @@ class Monitor extends BeanModel {
"Accept": "*/*",
"User-Agent": "Uptime-Kuma/" + version,
},
socketPath: this.docker_daemon,
httpsAgent: new https.Agent({
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
rejectUnauthorized: ! this.getIgnoreTls(),
}),
};
if (this.docker_type === "socket") {
options.socketPath = this.docker_daemon;
} else if (this.docker_type === "tcp") {
options.baseURL = this.docker_daemon;
}
debug(`[${this.name}] Axios Request`);
let res = await axios.request(options);
if (res.data.State.Running) {