Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
mobile/lib/core/config.dart
Normal file
24
mobile/lib/core/config.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
/// Configurazione globale dell'app Match Live TV.
|
||||
class AppConfig {
|
||||
AppConfig._();
|
||||
|
||||
/// URL base API Rails. Default emulatore Android → host localhost.
|
||||
static const String apiBaseUrl = String.fromEnvironment(
|
||||
'API_BASE_URL',
|
||||
defaultValue: 'http://10.0.2.2:3000',
|
||||
);
|
||||
|
||||
static String get apiV1 => '$apiBaseUrl/api/v1';
|
||||
|
||||
static String get cableUrl {
|
||||
final uri = Uri.parse(apiBaseUrl);
|
||||
final wsScheme = uri.scheme == 'https' ? 'wss' : 'ws';
|
||||
final defaultPort = uri.scheme == 'https' ? 443 : 80;
|
||||
final port = uri.hasPort ? uri.port : defaultPort;
|
||||
// Evita :443/:80 espliciti — alcuni client WebSocket/NPM li gestiscono male
|
||||
if (port == defaultPort) {
|
||||
return '$wsScheme://${uri.host}/cable';
|
||||
}
|
||||
return '$wsScheme://${uri.host}:$port/cable';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user