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`.
21 lines
689 B
TypeScript
21 lines
689 B
TypeScript
import "dotenv/config";
|
|
import type { AppConfig as SharedAppConfig } from "@bete/shared/config";
|
|
import { config as sharedConfig, loadConfig as sharedLoadConfig } from "@bete/shared/config";
|
|
|
|
// Re-export the unified config with EFFECTIVE_* fields added
|
|
export type AppConfig = SharedAppConfig & {
|
|
EFFECTIVE_TEXT_GUILD_ID?: string;
|
|
EFFECTIVE_VOICE_GUILD_ID?: string;
|
|
};
|
|
|
|
export function loadConfig(env: NodeJS.ProcessEnv = process.env): AppConfig {
|
|
const parsed = sharedLoadConfig(env);
|
|
return {
|
|
...parsed,
|
|
EFFECTIVE_TEXT_GUILD_ID: parsed.MONITOR_GUILD_ID,
|
|
EFFECTIVE_VOICE_GUILD_ID: parsed.VOICE_GUILD_ID ?? parsed.GUILD_ID,
|
|
};
|
|
}
|
|
|
|
export const config = loadConfig();
|