// Copyright (c) 2026 PowerOn AG // All rights reserved. /** * Configuration — reads mandatory env vars set by .env (copied from config/env-*.env by CI). * * NO silent fallbacks for critical values. * If VITE_API_BASE_URL is missing the app fails loudly at startup. * * Vite replaces import.meta.env.VITE_* statically at build time. * Dynamic access via import.meta.env[key] does NOT work in production builds. * Therefore each variable must be accessed with its literal property name. */ const _apiBaseUrl: string = import.meta.env.VITE_API_BASE_URL; if (!_apiBaseUrl) { throw new Error( 'Missing required env variable: VITE_API_BASE_URL. Ensure .env is present (cp config/env-.env .env).' ); } export const getApiBaseUrl = (): string => _apiBaseUrl; export const getAppName = (): string => import.meta.env.VITE_APP_NAME || 'PowerOn';