feat: update API base URL handling and improve Caddy configuration for Flutter app
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
/// Platform-neutral HTTP client wrapping the internal API base URL.
|
||||
/// Base URL is read from the FLUTTER_API_URL_INTERNAL environment variable
|
||||
/// (set by Docker) or falls back to localhost for local development.
|
||||
/// Platform-neutral HTTP client.
|
||||
/// API base URL is injected at build time via --dart-define=API_BASE_URL.
|
||||
/// Default is same-origin '/api' to avoid mixed-content on HTTPS sites.
|
||||
class ApiClient {
|
||||
final String baseUrl;
|
||||
final http.Client _client;
|
||||
@@ -10,7 +10,7 @@ class ApiClient {
|
||||
ApiClient({http.Client? client})
|
||||
: baseUrl = const String.fromEnvironment(
|
||||
'API_BASE_URL',
|
||||
defaultValue: 'http://localhost:8080',
|
||||
defaultValue: '/api',
|
||||
),
|
||||
_client = client ?? http.Client();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user