packages/uptime-kuma: drop the slash patch and give in to the insanity

This commit is contained in:
Max Headroom 2023-04-14 16:10:56 +02:00
parent beba81b358
commit 375a1e1bcc
3 changed files with 2 additions and 40 deletions

View file

@ -59,7 +59,8 @@ in
environment = { environment = {
NODE_ENV = "production"; NODE_ENV = "production";
DATA_DIR = dataDir; # immense stupidity: uptime-kuma expects this path to end in a slash
DATA_DIR = "${dataDir}/";
UPTIME_KUMA_HOST = link.ipv4; UPTIME_KUMA_HOST = link.ipv4;
UPTIME_KUMA_PORT = link.portStr; UPTIME_KUMA_PORT = link.portStr;
UPTIME_KUMA_HIDE_LOG = lib.concatStringsSep "," [ UPTIME_KUMA_HIDE_LOG = lib.concatStringsSep "," [

View file

@ -52,7 +52,6 @@ in
uptime-kuma.runtime-bugfixes = { uptime-kuma.runtime-bugfixes = {
patches = [ patches = [
./uptime-kuma/chmod-database.patch ./uptime-kuma/chmod-database.patch
./uptime-kuma/data-dir-concat-with-slash.patch
]; ];
}; };

View file

@ -1,38 +0,0 @@
diff --git a/server/database.js b/server/database.js
index 575827f3..8e288095 100644
--- a/server/database.js
+++ b/server/database.js
@@ -87,20 +87,20 @@ class Database {
*/
static init(args) {
// Data Directory (must be end with "/")
- Database.dataDir = process.env.DATA_DIR || args["data-dir"] || "./data/";
+ Database.dataDir = process.env.DATA_DIR || args["data-dir"] || "./data";
// Plugin feature is working only if the dataDir = "./data";
- if (Database.dataDir !== "./data/") {
+ if (Database.dataDir !== "./data") {
log.warn("PLUGIN", "Warning: In order to enable plugin feature, you need to use the default data directory: ./data/");
PluginsManager.disable = true;
}
- Database.path = Database.dataDir + "kuma.db";
+ Database.path = Database.dataDir + "/kuma.db";
if (! fs.existsSync(Database.dataDir)) {
fs.mkdirSync(Database.dataDir, { recursive: true });
}
- Database.uploadDir = Database.dataDir + "upload/";
+ Database.uploadDir = Database.dataDir + "/upload/";
if (! fs.existsSync(Database.uploadDir)) {
fs.mkdirSync(Database.uploadDir, { recursive: true });
@@ -455,7 +455,7 @@ class Database {
static backup(version) {
if (! this.backupPath) {
log.info("db", "Backing up the database");
- this.backupPath = this.dataDir + "kuma.db.bak" + version;
+ this.backupPath = this.dataDir + "/kuma.db.bak" + version;
fs.copyFileSync(Database.path, this.backupPath);
const shmPath = Database.path + "-shm";