refactor(shared): centralize configuration and types

Migrate configuration validation and core moderation types from individual services to the `@bete/shared` package to ensure consistency across the monorepo.

- Move `AppConfig` and moderation-related interfaces to `packages/shared`.
- Replace service-specific Zod schemas with the centralized shared configuration.
- Refactor `services/backend` and `services/discord-gateway` to consume shared config and types.
- Remove redundant type definitions and local configuration logic in services.
- Update `packages/shared` exports to include new `config` and `moderation-types` modules.
- Clean up unused files and deprecated utility functions in `packages/shared`.
This commit is contained in:
MythEclipse
2026-06-09 11:56:03 +07:00
parent f84b380f4f
commit 67d66bb5dd
26 changed files with 1193 additions and 1503 deletions
+2 -9
View File
@@ -32,14 +32,7 @@ const SUBSCRIPTIONS: ChannelMapping[] = [
let subscriber: Redis | null = null;
function createSubscriber(): Redis {
if (config.REDIS_URL) {
return new Redis(config.REDIS_URL, { keyPrefix: "" });
}
return new Redis({
host: config.REDIS_HOST,
port: config.REDIS_PORT,
keyPrefix: "",
});
return new Redis(config.REDIS_URL, { keyPrefix: "" });
}
/**
@@ -93,7 +86,7 @@ function handleSubscriptionMessage(channel: string, message: string): void {
}
export async function startRedisBridge(): Promise<void> {
if (!config.REDIS_URL && !config.REDIS_HOST) {
if (!config.REDIS_URL) {
logger.info("Redis not configured, skipping Redis bridge");
return;
}