import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; /** Liest mobile/.env (ohne zusätzliche Abhängigkeit) */ export function loadEnv() { const file = path.join(path.dirname(fileURLToPath(import.meta.url)), '.env'); const env = {}; if (fs.existsSync(file)) { for (const line of fs.readFileSync(file, 'utf8').split('\n')) { const m = line.match(/^\s*([A-Z_]+)\s*=\s*(.*?)\s*$/); if (m) env[m[1]] = m[2].replace(/^["']|["']$/g, ''); } } const get = (k, d) => process.env[k] || env[k] || d; return { appUrl: get('APP_URL', 'https://app.example.org').replace(/\/+$/, ''), appId: get('APP_ID', 'org.example.werkstattapp'), appName: get('APP_NAME', 'Werkstatt-App'), brandColor: get('BRAND_COLOR', '#2e2672') }; }