managarten/services/mana-subscriptions/src/config.ts
Till JS 3ea28b9065 refactor(db): consolidate ~20+ databases into 2 (mana_platform + mana_sync)
Mirrors the frontend unification (single IndexedDB) on the backend.
All services now use pgSchema() for isolation within one shared database,
enabling cross-schema JOINs, simplified ops, and zero DB setup for new apps.

- Migrate 7 services from pgTable() to pgSchema(): mana-user (usr),
  mana-media (media), todo, traces, presi, uload, cards
- Update all DATABASE_URLs in .env.development, docker-compose, configs
- Rewrite init-db scripts for 2 databases + 12 schemas
- Rewrite setup-databases.sh for consolidated architecture
- Update shared-drizzle-config default to mana_platform
- Update CLAUDE.md with new database architecture docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:31:28 +02:00

28 lines
873 B
TypeScript

export interface Config {
port: number;
databaseUrl: string;
manaAuthUrl: string;
serviceKey: string;
baseUrl: string;
stripe: { secretKey: string; webhookSecret: string };
cors: { origins: string[] };
}
export function loadConfig(): Config {
const env = (key: string, fallback?: string) => process.env[key] || fallback || '';
return {
port: parseInt(env('PORT', '3063'), 10),
databaseUrl: env(
'DATABASE_URL',
'postgresql://manacore:devpassword@localhost:5432/mana_platform'
),
manaAuthUrl: env('MANA_CORE_AUTH_URL', 'http://localhost:3001'),
serviceKey: env('MANA_CORE_SERVICE_KEY', 'dev-service-key'),
baseUrl: env('BASE_URL', 'http://localhost:3063'),
stripe: {
secretKey: env('STRIPE_SECRET_KEY'),
webhookSecret: env('STRIPE_WEBHOOK_SECRET'),
},
cors: { origins: env('CORS_ORIGINS', 'http://localhost:5173').split(',') },
};
}