import 'app_config.dart'; /// Exception thrown when an invalid environment is provided to [ConfigLoader]. class InvalidEnvironmentException implements Exception { /// The invalid environment that was provided. final String environment; /// Creates an [InvalidEnvironmentException] with the provided environment. InvalidEnvironmentException(this.environment); @override String toString() { return 'InvalidEnvironmentException: Invalid environment "$environment". ' 'Valid environments are: dev, prod'; } } /// Loads application configuration based on the specified environment. /// /// This class provides a factory method to load configuration for either /// 'dev' or 'prod' environments. It throws [InvalidEnvironmentException] /// if an invalid environment is provided. class ConfigLoader { /// Private constructor to prevent instantiation. ConfigLoader._(); /// Loads configuration for the specified environment. /// /// [environment] - The environment to load ('dev' or 'prod'). /// /// Returns an [AppConfig] instance for the specified environment. /// /// Throws [InvalidEnvironmentException] if [environment] is not 'dev' or 'prod'. static AppConfig load(String environment) { switch (environment.toLowerCase()) { case 'dev': return const AppConfig( apiBaseUrl: 'https://api-dev.example.com', enableLogging: true, immichBaseUrl: 'https://photos.satoshinakamoto.win', // ← Change your Immich server URL here immichApiKey: '3v2fTujMJHy1T2rrVJVojdJS0ySm7IRcRvEcvvUvs0', // ← Change your Immich API key here nostrRelays: [ // ← Add Nostr relay URLs for testing 'wss://nostrum.satoshinakamoto.win', 'wss://nos.lol', ], ); case 'prod': return const AppConfig( apiBaseUrl: 'https://api.example.com', enableLogging: false, immichBaseUrl: 'https://photos.satoshinakamoto.win', // ← Change your Immich server URL here immichApiKey: 'your-prod-api-key-here', // ← Change your Immich API key here nostrRelays: [ // ← Add Nostr relay URLs for production 'wss://relay.damus.io', ], ); default: throw InvalidEnvironmentException(environment); } } }