mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 11:46:41 +02:00
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>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
/**
|
|
* Application configuration loaded from environment variables.
|
|
*/
|
|
|
|
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 requiredEnv = (key: string, fallback?: string): string => {
|
|
const value = process.env[key] || fallback;
|
|
if (!value) throw new Error(`Missing required env var: ${key}`);
|
|
return value;
|
|
};
|
|
|
|
return {
|
|
port: parseInt(process.env.PORT || '3061', 10),
|
|
databaseUrl: requiredEnv(
|
|
'DATABASE_URL',
|
|
'postgresql://manacore:devpassword@localhost:5432/mana_platform'
|
|
),
|
|
manaAuthUrl: requiredEnv('MANA_CORE_AUTH_URL', 'http://localhost:3001'),
|
|
serviceKey: requiredEnv('MANA_CORE_SERVICE_KEY', 'dev-service-key'),
|
|
baseUrl: requiredEnv('BASE_URL', 'http://localhost:3060'),
|
|
stripe: {
|
|
secretKey: process.env.STRIPE_SECRET_KEY || '',
|
|
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET || '',
|
|
},
|
|
cors: {
|
|
origins: (process.env.CORS_ORIGINS || 'http://localhost:5173').split(','),
|
|
},
|
|
};
|
|
}
|