mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-30 18:24:03 +00:00
fix reset-password (#448)
This commit is contained in:
parent
3fc2ba3d76
commit
b0e9c5bcb4
3 changed files with 13 additions and 8 deletions
|
@ -6,12 +6,14 @@ const Database = require("../server/database");
|
||||||
const { R } = require("redbean-node");
|
const { R } = require("redbean-node");
|
||||||
const readline = require("readline");
|
const readline = require("readline");
|
||||||
const { initJWTSecret } = require("../server/util-server");
|
const { initJWTSecret } = require("../server/util-server");
|
||||||
|
const args = require("args-parser")(process.argv);
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout
|
output: process.stdout
|
||||||
});
|
});
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
Database.init(args);
|
||||||
await Database.connect();
|
await Database.connect();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -42,6 +42,16 @@ class Database {
|
||||||
|
|
||||||
static noReject = true;
|
static noReject = true;
|
||||||
|
|
||||||
|
static init(args) {
|
||||||
|
// 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(Database.dataDir)) {
|
||||||
|
fs.mkdirSync(Database.dataDir, { recursive: true });
|
||||||
|
}
|
||||||
|
console.log(`Data Dir: ${Database.dataDir}`);
|
||||||
|
}
|
||||||
|
|
||||||
static async connect() {
|
static async connect() {
|
||||||
const acquireConnectionTimeout = 120 * 1000;
|
const acquireConnectionTimeout = 120 * 1000;
|
||||||
|
|
||||||
|
|
|
@ -69,14 +69,6 @@ if (demoMode) {
|
||||||
console.log("==== Demo Mode ====");
|
console.log("==== Demo Mode ====");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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(Database.dataDir)) {
|
|
||||||
fs.mkdirSync(Database.dataDir, { recursive: true });
|
|
||||||
}
|
|
||||||
console.log(`Data Dir: ${Database.dataDir}`);
|
|
||||||
|
|
||||||
console.log("Creating express and socket.io instance")
|
console.log("Creating express and socket.io instance")
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
@ -132,6 +124,7 @@ let needSetup = false;
|
||||||
let indexHTML = fs.readFileSync("./dist/index.html").toString();
|
let indexHTML = fs.readFileSync("./dist/index.html").toString();
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
Database.init(args);
|
||||||
await initDatabase();
|
await initDatabase();
|
||||||
|
|
||||||
console.log("Adding route")
|
console.log("Adding route")
|
||||||
|
|
Loading…
Reference in a new issue