Add initfolderchartlookup handling

This commit is contained in:
zkldi
2021-11-05 00:48:30 +00:00
parent 6e6ecd29af
commit f482f31133
2 changed files with 10 additions and 0 deletions
@@ -12,6 +12,7 @@ import { ICollection } from "monk";
import os from "os";
import path from "path";
import { ChartDocument, FolderDocument, SongDocument, TableDocument } from "tachi-common";
import { InitaliseFolderChartLookup } from "utils/folder";
interface SyncInstructions {
pattern: RegExp;
@@ -147,6 +148,7 @@ const syncInstructions: SyncInstructions[] = [
if (bwriteOps.length) {
await collection.bulkWrite(bwriteOps);
await InitaliseFolderChartLookup();
}
},
},
+8
View File
@@ -8,6 +8,7 @@ import CreateLogCtx from "lib/logger/logger";
import { Environment, ServerConfig, ServerTypeInfo } from "lib/setup/config";
import path from "path";
import server from "server/server";
import { InitaliseFolderChartLookup } from "utils/folder";
import { FormatVersion } from "./lib/constants/version";
const logger = CreateLogCtx(__filename);
@@ -30,6 +31,13 @@ db.users.indexes().then((r) => {
}
});
db["folder-chart-lookup"].findOne().then((r) => {
// If there are no folder chart lookups, initialise them.
if (!r) {
InitaliseFolderChartLookup();
}
});
if (ServerConfig.ENABLE_SERVER_HTTPS) {
logger.warn(
"HTTPS Mode is enabled. This should not be used in production, and you should instead run behind a reverse proxy."