amoriai/lib/core/config/app_config.dart

94 lines
2.8 KiB
Dart

import 'package:flutter/foundation.dart';
class AppConfig {
static const String _prodApiUrl = 'https://api.muningkofie.com';
static const String _devApiUrl = 'https://dev-api.muningkofie.com';
static const String _localApiUrl = 'http://localhost:3000';
// Environment-based configuration
static String get apiUrl {
if (kDebugMode) {
return _devApiUrl;
} else if (kProfileMode) {
return _prodApiUrl;
} else {
return _prodApiUrl;
}
}
static bool get isDebugMode => kDebugMode;
static bool get isReleaseMode => kReleaseMode;
static bool get isProfileMode => kProfileMode;
// Firebase configuration
static const String firebaseProjectId = 'muning-menu-recommender';
static const String firebaseStorageBucket =
'muning-menu-recommender.appspot.com';
// Google Services
static const String googleSignInClientId = String.fromEnvironment(
'GOOGLE_SIGN_IN_CLIENT_ID',
defaultValue:
'624527944720-2hngapf8r7d1smh8114uioii2fr4bhv3.apps.googleusercontent.com', // Fallback for development
);
// API Keys
static const String geminiApiKey = String.fromEnvironment(
'GEMINI_API_KEY',
defaultValue:
'AIzaSyC7mYgCfQCkBVK-Mia2NduOXyRMcsaCh10', // Restored to working key
);
// Feature flags
static const bool enableGoogleSignIn = true;
static const bool enableOfflineMode = true;
static const bool enablePushNotifications = true;
static const bool enableAnalytics = true;
static const bool enableCrashlytics = true;
// App settings
static const int maxRecommendationHistory = 50;
static const int maxImageCacheSize = 100; // MB
static const Duration cacheExpiration = Duration(days: 7);
// OCR settings
static const double minOcrConfidence = 0.6;
static const int maxOcrRetries = 3;
// AI settings
static const int maxTokensPerRequest = 8192;
static const double aiTemperature = 0.2; // Rendah = output JSON lebih konsisten
static const int maxConversationHistory = 10;
// Helper method to check if Gemini is configured
static bool get isGeminiConfigured {
return geminiApiKey.isNotEmpty;
}
// Validation
static bool get isConfigValid {
if (!isGeminiConfigured) {
debugPrint('Warning: GEMINI_API_KEY is not set');
return false;
}
return true;
}
// Debug helpers
static void printConfig() {
if (kDebugMode) {
debugPrint('=== App Configuration ===');
debugPrint('API URL: $apiUrl');
debugPrint('Debug Mode: $isDebugMode');
debugPrint(
'Gemini API Key: ${geminiApiKey.isNotEmpty ? "Set" : "Not Set"}',
);
debugPrint(
'Google Sign-In: ${googleSignInClientId.isNotEmpty ? "Set" : "Not Set"}',
);
debugPrint('Config Valid: $isConfigValid');
debugPrint('========================');
}
}
}