From c9919756e4d3b7a7c00fb23285b26fbc1bee9ddb Mon Sep 17 00:00:00 2001 From: UnwishingMoon <11472973+UnwishingMoon@users.noreply.github.com> Date: Sun, 18 Jan 2026 14:50:12 +0100 Subject: [PATCH] Exported DB Socket to frontend during setup page, used only env variable as DB Socket, removed socket checks and let knex handles it --- server/setup-database.js | 19 ++++--------------- src/lang/en.json | 2 +- src/pages/SetupDatabase.vue | 24 +++++++++++++++++++----- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/server/setup-database.js b/server/setup-database.js index 7f99eddb0..d78af3d29 100644 --- a/server/setup-database.js +++ b/server/setup-database.js @@ -161,6 +161,7 @@ class SetupDatabase { runningSetup: this.runningSetup, needSetup: this.needSetup, isEnabledEmbeddedMariaDB: this.isEnabledEmbeddedMariaDB(), + isEnabledMariaDBSocket: (process.env.UPTIME_KUMA_DB_SOCKET && process.env.UPTIME_KUMA_DB_SOCKET.trim().length > 0) || false, }); }); @@ -205,22 +206,10 @@ class SetupDatabase { if (dbConfig.type === "mariadb") { // If socketPath is provided and not empty, validate it if ( - dbConfig.socketPath && - typeof dbConfig.socketPath === "string" && - dbConfig.socketPath.trim().length > 0 + process.env.UPTIME_KUMA_DB_SOCKET && + process.env.UPTIME_KUMA_DB_SOCKET.trim().length > 0 ) { - // Checking if the path exists and is a socket - if (!fs.existsSync(dbConfig.socketPath)) { - response.status(400).json("The path to the Socket does not exist"); - this.runningSetup = false; - return; - } - - if (!fs.lstatSync(dbConfig.socketPath).isSocket()) { - response.status(400).json("The path provided is not a Socket"); - this.runningSetup = false; - return; - } + dbConfig.socketPath = process.env.UPTIME_KUMA_DB_SOCKET; } else { // socketPath not provided, hostname and port are required if (!dbConfig.hostname) { diff --git a/src/lang/en.json b/src/lang/en.json index 62d1d23c5..907e6941e 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1362,5 +1362,5 @@ "None (Successful Connection)": "None (Successful Connection)", "expectedTlsAlertDescription": "Select the TLS alert you expect the server to return. Use {code} to verify mTLS endpoints reject connections without client certificates. See {link} for details.", "TLS Alert Spec": "RFC 8446", - "socketPath": "Path to socket" + "mariadbSocketPathDetectedHelptext": "environment variable detected, Hostname and Port will be ignored." } diff --git a/src/pages/SetupDatabase.vue b/src/pages/SetupDatabase.vue index 2247712d7..6cbd06786 100644 --- a/src/pages/SetupDatabase.vue +++ b/src/pages/SetupDatabase.vue @@ -86,21 +86,25 @@ type="text" class="form-control" required + :disabled="!disabledButtonMariaDBSocket" />
- +
-
- - +
+
+ UPTIME_KUMA_DB_SOCKET {{ $t("mariadbSocketPathDetectedHelptext") }} +
-
+
+ +