diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index 0f32017f8..67b6ed0a3 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -8,7 +8,7 @@ const { log } = require("../src/util"); const Database = require("./database"); const util = require("util"); const { CacheableDnsHttpAgent } = require("./cacheable-dns-http-agent"); -const { setting } = require("./util-server"); +const { Settings } = require("./settings"); /** * `module.exports` (alias: `server`) should be inside this class, in order to avoid circular dependency issue. @@ -133,7 +133,7 @@ class UptimeKumaServer { async getClientIP(socket) { const clientIP = socket.client.conn.remoteAddress.replace(/^.*:/, ""); - if (await setting("trustProxy")) { + if (await Settings.get("trustProxy")) { return socket.client.conn.request.headers["x-forwarded-for"] || socket.client.conn.request.headers["x-real-ip"] || clientIP; diff --git a/server/util-server.js b/server/util-server.js index 84244b02b..df711cf05 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -289,6 +289,7 @@ exports.postgresQuery = function (connectionString, query) { * Retrieve value of setting based on key * @param {string} key Key of setting to retrieve * @returns {Promise} Value + * @deprecated Use await Settings.get(key) */ exports.setting = async function (key) { return await Settings.get(key);