31 lines
962 B
Dart
31 lines
962 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 const e2eAccessToken = String.fromEnvironment('AIOA_E2E_ACCESS_TOKEN');
|
|
static const e2eEmployeeToken = String.fromEnvironment(
|
|
'AIOA_E2E_EMPLOYEE_TOKEN',
|
|
);
|
|
static const e2eRole = String.fromEnvironment('AIOA_E2E_ROLE');
|
|
|
|
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';
|
|
}
|
|
}
|