Phase 2 complete
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/// Configuration class that holds application settings.
|
||||
///
|
||||
/// This class contains environment-specific configuration values
|
||||
/// such as API base URL and logging settings.
|
||||
/// such as API base URL, Immich settings, and logging settings.
|
||||
class AppConfig {
|
||||
/// The base URL for API requests.
|
||||
final String apiBaseUrl;
|
||||
@@ -9,18 +9,29 @@ class AppConfig {
|
||||
/// Whether logging is enabled in the application.
|
||||
final bool enableLogging;
|
||||
|
||||
/// Immich server base URL (e.g., 'https://immich.example.com').
|
||||
final String immichBaseUrl;
|
||||
|
||||
/// Immich API key for authentication.
|
||||
final String immichApiKey;
|
||||
|
||||
/// Creates an [AppConfig] instance with the provided values.
|
||||
///
|
||||
/// [apiBaseUrl] - The base URL for API requests.
|
||||
/// [enableLogging] - Whether logging should be enabled.
|
||||
/// [immichBaseUrl] - Immich server base URL.
|
||||
/// [immichApiKey] - Immich API key for authentication.
|
||||
const AppConfig({
|
||||
required this.apiBaseUrl,
|
||||
required this.enableLogging,
|
||||
required this.immichBaseUrl,
|
||||
required this.immichApiKey,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AppConfig(apiBaseUrl: $apiBaseUrl, enableLogging: $enableLogging)';
|
||||
return 'AppConfig(apiBaseUrl: $apiBaseUrl, enableLogging: $enableLogging, '
|
||||
'immichBaseUrl: $immichBaseUrl)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -28,10 +39,16 @@ class AppConfig {
|
||||
if (identical(this, other)) return true;
|
||||
return other is AppConfig &&
|
||||
other.apiBaseUrl == apiBaseUrl &&
|
||||
other.enableLogging == enableLogging;
|
||||
other.enableLogging == enableLogging &&
|
||||
other.immichBaseUrl == immichBaseUrl &&
|
||||
other.immichApiKey == immichApiKey;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => apiBaseUrl.hashCode ^ enableLogging.hashCode;
|
||||
int get hashCode =>
|
||||
apiBaseUrl.hashCode ^
|
||||
enableLogging.hashCode ^
|
||||
immichBaseUrl.hashCode ^
|
||||
immichApiKey.hashCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,15 @@ class ConfigLoader {
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
default:
|
||||
throw InvalidEnvironmentException(environment);
|
||||
|
||||
Reference in New Issue
Block a user