mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
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:
parent
d4afd84019
commit
54fd81f076
118 changed files with 3892 additions and 5291 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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`;
|
||||
|
|
|
|||
|
|
@ -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`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue