refactor(config): ♻️ Redo config structure from scratch, simplify validation code, improve checks, add support for loading sensitive data from paths

This commit is contained in:
Jesse Wierzbinski 2025-02-15 02:47:29 +01:00
parent d4afd84019
commit 54fd81f076
No known key found for this signature in database
118 changed files with 3892 additions and 5291 deletions

View file

@ -2,7 +2,7 @@ import cluster from "node:cluster";
import { sentry } from "@/sentry";
import { createServer } from "@/server";
import { appFactory } from "~/app";
import { config } from "~/packages/config-manager/index.ts";
import { config } from "~/config.ts";
process.on("SIGINT", () => {
process.exit();

View file

@ -1,10 +1,9 @@
import { checkConfig } from "@/init";
import { configureLoggers } from "@/loggers";
import { getLogger } from "@logtape/logtape";
import { Note } from "@versia/kit/db";
import IORedis from "ioredis";
import { config } from "~/config.ts";
import { setupDatabase } from "~/drizzle/db";
import { config } from "~/packages/config-manager/index.ts";
import { searchManager } from "../../classes/search/search-manager.ts";
const timeAtStart = performance.now();
@ -26,15 +25,13 @@ serverLogger.info`Starting Versia Server...`;
await setupDatabase();
if (config.sonic.enabled) {
if (config.search.enabled) {
await searchManager.connect();
}
// Check if database is reachable
const postCount = await Note.getCount();
await checkConfig(config);
serverLogger.info`Versia Server started at ${config.http.bind}:${config.http.bind_port} in ${(performance.now() - timeAtStart).toFixed(0)}ms`;
serverLogger.info`Database is online, now serving ${postCount} posts`;