mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Add ability to connect to daemon via http / tcp for windows compatibility
This commit is contained in:
parent
4818bb67d6
commit
29df70949d
5 changed files with 29 additions and 1 deletions
|
@ -7,4 +7,7 @@ ALTER TABLE monitor
|
|||
ALTER TABLE monitor
|
||||
ADD docker_container VARCHAR(255);
|
||||
|
||||
ALTER TABLE monitor
|
||||
ADD docker_type VARCHAR(255);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -590,6 +590,7 @@ exports.entryPage = "dashboard";
|
|||
bean.pushToken = monitor.pushToken;
|
||||
bean.docker_container = monitor.docker_container;
|
||||
bean.docker_daemon = monitor.docker_daemon;
|
||||
bean.docker_type = monitor.docker_type;
|
||||
|
||||
await R.store(bean);
|
||||
|
||||
|
|
|
@ -364,4 +364,7 @@ export default {
|
|||
"Container Name / ID": "Container Name / ID",
|
||||
"Docker Daemon": "Docker Daemon",
|
||||
"Docker Container": "Docker Container",
|
||||
"Docker Type": "Connection Type",
|
||||
docker_socket: "Socket",
|
||||
docker_tcp: "TCP / HTTP",
|
||||
};
|
||||
|
|
|
@ -125,6 +125,20 @@
|
|||
<input id="docker_container" v-model="monitor.docker_container" type="text" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<!-- Docker Connection Type -->
|
||||
<!-- For Docker Type -->
|
||||
<div v-if="monitor.type === 'docker'" class="my-3">
|
||||
<label for="docker_type" class="form-label">{{ $t("Docker Type") }}</label>
|
||||
<select id="docker_type" v-model="monitor.docker_type" class="form-select">
|
||||
<option value="socket">
|
||||
{{ $t("docker_socket") }}
|
||||
</option>
|
||||
<option value="tcp">
|
||||
{{ $t("docker_tcp") }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Docker Daemon -->
|
||||
<!-- For Docker Type -->
|
||||
<div v-if="monitor.type === 'docker'" class="my-3">
|
||||
|
@ -458,6 +472,7 @@ export default {
|
|||
dns_resolve_server: "1.1.1.1",
|
||||
docker_container: "",
|
||||
docker_daemon: "/var/run/docker.sock",
|
||||
docker_type: "socket",
|
||||
};
|
||||
|
||||
for (let i = 0; i < this.$root.notificationList.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue