feat: update API base URL handling and improve Caddy configuration for Flutter app

This commit is contained in:
Nils-Johan Gynther
2026-04-21 21:59:47 +02:00
parent ac5891394e
commit 39384a0e74
4 changed files with 19 additions and 10 deletions
+4 -4
View File
@@ -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();