mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Ignore TLS/SSL error for Redis (#3878)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
55b2d4b907
commit
daca38a554
4 changed files with 11 additions and 6 deletions
|
@ -852,7 +852,7 @@ class Monitor extends BeanModel {
|
||||||
} else if (this.type === "redis") {
|
} else if (this.type === "redis") {
|
||||||
let startTime = dayjs().valueOf();
|
let startTime = dayjs().valueOf();
|
||||||
|
|
||||||
bean.msg = await redisPingAsync(this.databaseConnectionString);
|
bean.msg = await redisPingAsync(this.databaseConnectionString, !this.ignoreTls);
|
||||||
bean.status = UP;
|
bean.status = UP;
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
|
|
||||||
|
|
|
@ -486,12 +486,16 @@ exports.radius = function (
|
||||||
/**
|
/**
|
||||||
* Redis server ping
|
* Redis server ping
|
||||||
* @param {string} dsn The redis connection string
|
* @param {string} dsn The redis connection string
|
||||||
* @returns {Promise<any>} Response from redis server
|
* @param {boolean} rejectUnauthorized If false, allows unverified server certificates.
|
||||||
|
* @returns {Promise<any>} Response from server
|
||||||
*/
|
*/
|
||||||
exports.redisPingAsync = function (dsn) {
|
exports.redisPingAsync = function (dsn, rejectUnauthorized) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const client = redis.createClient({
|
const client = redis.createClient({
|
||||||
url: dsn
|
url: dsn,
|
||||||
|
socket: {
|
||||||
|
rejectUnauthorized
|
||||||
|
}
|
||||||
});
|
});
|
||||||
client.on("error", (err) => {
|
client.on("error", (err) => {
|
||||||
if (client.isOpen) {
|
if (client.isOpen) {
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
"resendDisabled": "Resend disabled",
|
"resendDisabled": "Resend disabled",
|
||||||
"retriesDescription": "Maximum retries before the service is marked as down and a notification is sent",
|
"retriesDescription": "Maximum retries before the service is marked as down and a notification is sent",
|
||||||
"ignoreTLSError": "Ignore TLS/SSL errors for HTTPS websites",
|
"ignoreTLSError": "Ignore TLS/SSL errors for HTTPS websites",
|
||||||
|
"ignoreTLSErrorGeneral": "Ignore TLS/SSL error for connection",
|
||||||
"upsideDownModeDescription": "Flip the status upside down. If the service is reachable, it is DOWN.",
|
"upsideDownModeDescription": "Flip the status upside down. If the service is reachable, it is DOWN.",
|
||||||
"maxRedirectDescription": "Maximum number of redirects to follow. Set to 0 to disable redirects.",
|
"maxRedirectDescription": "Maximum number of redirects to follow. Set to 0 to disable redirects.",
|
||||||
"Upside Down Mode": "Upside Down Mode",
|
"Upside Down Mode": "Upside Down Mode",
|
||||||
|
|
|
@ -508,10 +508,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' " class="my-3 form-check">
|
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'redis' " class="my-3 form-check">
|
||||||
<input id="ignore-tls" v-model="monitor.ignoreTls" class="form-check-input" type="checkbox" value="">
|
<input id="ignore-tls" v-model="monitor.ignoreTls" class="form-check-input" type="checkbox" value="">
|
||||||
<label class="form-check-label" for="ignore-tls">
|
<label class="form-check-label" for="ignore-tls">
|
||||||
{{ $t("ignoreTLSError") }}
|
{{ monitor.type === "redis" ? $t("ignoreTLSErrorGeneral") : $t("ignoreTLSError") }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue