fix(alerts): default road alert providers backend URL to production gateway with environment fallback

This commit is contained in:
Developer 2026-10-10 20:19:50 -04:00
parent 32907213c4
commit 8a60da6328
2 changed files with 18 additions and 10 deletions

View File

@ -14,11 +14,15 @@ class Georgia511RoadAlertProvider implements RoadAlertProvider {
http.Client? client,
String? backendBaseUrl,
}) : _client = client ?? http.Client(),
backendBaseUrl = backendBaseUrl ??
const String.fromEnvironment(
'MOTORSIGNAL_API_URL',
defaultValue: 'http://127.0.0.1:8000',
);
backendBaseUrl = backendBaseUrl ?? _resolveDefaultBaseUrl();
static String _resolveDefaultBaseUrl() {
const apiUrl = String.fromEnvironment('MOTORSIGNAL_API_URL');
if (apiUrl.isNotEmpty) return apiUrl;
const apiBaseUrl = String.fromEnvironment('MOTORSIGNAL_API_BASE_URL');
if (apiBaseUrl.isNotEmpty) return apiBaseUrl;
return 'https://api.motorsignal.app';
}
@override
String get id => 'ga511_official';

View File

@ -19,11 +19,15 @@ class ZylaRoadAlertProvider implements RoadAlertProvider {
String? backendBaseUrl,
this.getAuthToken,
}) : _client = client ?? http.Client(),
backendBaseUrl = backendBaseUrl ??
const String.fromEnvironment(
'MOTORSIGNAL_API_URL',
defaultValue: 'http://127.0.0.1:8000',
);
backendBaseUrl = backendBaseUrl ?? _resolveDefaultBaseUrl();
static String _resolveDefaultBaseUrl() {
const apiUrl = String.fromEnvironment('MOTORSIGNAL_API_URL');
if (apiUrl.isNotEmpty) return apiUrl;
const apiBaseUrl = String.fromEnvironment('MOTORSIGNAL_API_BASE_URL');
if (apiBaseUrl.isNotEmpty) return apiBaseUrl;
return 'https://api.motorsignal.app';
}
@override
String get id => 'zyla_waze_4814';