|
|
|
@ -3,6 +3,7 @@ const { R } = require("redbean-node");
|
|
|
|
|
const { setSetting, setting } = require("./util-server");
|
|
|
|
|
const { log, sleep } = require("../src/util");
|
|
|
|
|
const knex = require("knex");
|
|
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Database & App Data Folder
|
|
|
|
@ -94,19 +95,19 @@ class Database {
|
|
|
|
|
// Data Directory (must be end with "/")
|
|
|
|
|
Database.dataDir = process.env.DATA_DIR || args["data-dir"] || "./data/";
|
|
|
|
|
|
|
|
|
|
Database.path = Database.dataDir + "kuma.db";
|
|
|
|
|
Database.path = path.join(Database.dataDir, "kuma.db");
|
|
|
|
|
if (! fs.existsSync(Database.dataDir)) {
|
|
|
|
|
fs.mkdirSync(Database.dataDir, { recursive: true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Database.uploadDir = Database.dataDir + "upload/";
|
|
|
|
|
Database.uploadDir = path.join(Database.dataDir, "upload/");
|
|
|
|
|
|
|
|
|
|
if (! fs.existsSync(Database.uploadDir)) {
|
|
|
|
|
fs.mkdirSync(Database.uploadDir, { recursive: true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create screenshot dir
|
|
|
|
|
Database.screenshotDir = Database.dataDir + "screenshots/";
|
|
|
|
|
Database.screenshotDir = path.join(Database.dataDir, "screenshots/");
|
|
|
|
|
if (! fs.existsSync(Database.screenshotDir)) {
|
|
|
|
|
fs.mkdirSync(Database.screenshotDir, { recursive: true });
|
|
|
|
|
}
|
|
|
|
|