allow changing data dir

This commit is contained in:
LouisLam 2021-09-02 20:27:18 +08:00
parent dac410c850
commit c74986647e
2 changed files with 11 additions and 4 deletions

View file

@ -5,7 +5,8 @@ const { setSetting, setting } = require("./util-server");
class Database {
static templatePath = "./db/kuma.db"
static path = "./data/kuma.db";
static dataDir = "./data/";
static path = this.dataDir + "kuma.db";
static latestVersion = 8;
static noReject = true;
static sqliteInstance = null;
@ -56,7 +57,7 @@ class Database {
console.info("Database patch is needed")
console.info("Backup the db")
const backupPath = "./data/kuma.db.bak" + version;
const backupPath = this.dataDir + "kuma.db.bak" + version;
fs.copyFileSync(Database.path, backupPath);
const shmPath = Database.path + "-shm";