mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 03:58:27 +08:00
Ignore TLS/SSL error for Redis (#3878)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
@@ -852,7 +852,7 @@ class Monitor extends BeanModel {
|
||||
} else if (this.type === "redis") {
|
||||
let startTime = dayjs().valueOf();
|
||||
|
||||
bean.msg = await redisPingAsync(this.databaseConnectionString);
|
||||
bean.msg = await redisPingAsync(this.databaseConnectionString, !this.ignoreTls);
|
||||
bean.status = UP;
|
||||
bean.ping = dayjs().valueOf() - startTime;
|
||||
|
||||
|
@@ -486,12 +486,16 @@ exports.radius = function (
|
||||
/**
|
||||
* Redis server ping
|
||||
* @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) => {
|
||||
const client = redis.createClient({
|
||||
url: dsn
|
||||
url: dsn,
|
||||
socket: {
|
||||
rejectUnauthorized
|
||||
}
|
||||
});
|
||||
client.on("error", (err) => {
|
||||
if (client.isOpen) {
|
||||
|
Reference in New Issue
Block a user