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

@ -1,11 +1,10 @@
import { checkConfig } from "@/init";
import { configureLoggers } from "@/loggers";
import { getLogger } from "@logtape/logtape";
import { Note } from "@versia/kit/db";
import chalk from "chalk";
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();
@ -28,15 +27,13 @@ serverLogger.info`Starting Versia Server Worker...`;
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 Worker started at ${config.http.bind}:${config.http.bind_port} in ${(performance.now() - timeAtStart).toFixed(0)}ms`;
serverLogger.info`Database is online, containing ${postCount} posts`;