diff --git a/server/database.js b/server/database.js index c4e1bce9f..77c4da758 100644 --- a/server/database.js +++ b/server/database.js @@ -12,10 +12,6 @@ class Database { static sqliteInstance = null; static async connect() { - if (! fs.existsSync(this.dataDir)) { - fs.mkdirSync(this.dataDir, { recursive: true }); - } - const acquireConnectionTimeout = 120 * 1000; R.setup("sqlite", { diff --git a/server/server.js b/server/server.js index 3c0d281db..42a17679b 100644 --- a/server/server.js +++ b/server/server.js @@ -53,6 +53,9 @@ const sslCert = process.env.SSL_CERT || args["ssl-cert"] || undefined; // Data Directory (must be end with "/") Database.dataDir = process.env.DATA_DIR || args["data-dir"] || "./data/"; Database.path = Database.dataDir + "kuma.db"; +if (! fs.existsSync(this.dataDir)) { + fs.mkdirSync(this.dataDir, { recursive: true }); +} console.log(`Data Dir: ${Database.dataDir}`); console.log("Creating express and socket.io instance")