26 lines
721 B
Dart
26 lines
721 B
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
class RuntimeConfig {
|
|
static const _configuredApiBaseUrl = String.fromEnvironment(
|
|
'AIOA_API_BASE_URL',
|
|
);
|
|
static const _configuredOidcIssuer = String.fromEnvironment(
|
|
'AIOA_OIDC_ISSUER',
|
|
);
|
|
|
|
static String get apiBaseUrl => _configuredApiBaseUrl.isNotEmpty
|
|
? _configuredApiBaseUrl
|
|
: '${_localOrigin(8080)}/api/v1';
|
|
|
|
static String get oidcIssuer => _configuredOidcIssuer.isNotEmpty
|
|
? _configuredOidcIssuer
|
|
: 'http://localhost:8081/realms/aioa';
|
|
|
|
static String _localOrigin(int port) {
|
|
final host = defaultTargetPlatform == TargetPlatform.android
|
|
? '10.0.2.2'
|
|
: '127.0.0.1';
|
|
return 'http://$host:$port';
|
|
}
|
|
}
|