- Default API URLs now use LAN IPs (192.168.86.149) - Auth interceptor skips auth when using LAN endpoints - Production builds override with --dart-define Development: flutter run -d chrome (no auth needed on LAN) Production: flutter build web --dart-define=CORE_API_URL=https://api.schweitz.net 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.8 KiB
Dart
62 lines
1.8 KiB
Dart
/// Application configuration from compile-time environment variables.
|
|
///
|
|
/// ## Development (LAN - no auth required)
|
|
/// Default values use LAN IPs for local development:
|
|
/// ```bash
|
|
/// flutter run -d chrome
|
|
/// ```
|
|
///
|
|
/// ## Production (public URLs - auth required)
|
|
/// Override with public URLs for production builds:
|
|
/// ```bash
|
|
/// flutter build web \
|
|
/// --dart-define=CORE_API_URL=https://api.schweitz.net \
|
|
/// --dart-define=TATLOCK_API_URL=https://tatlock.schweitz.net
|
|
/// ```
|
|
class AppConfig {
|
|
AppConfig._();
|
|
|
|
/// Core API base URL
|
|
/// - LAN default: No auth required
|
|
/// - Production: https://api.schweitz.net (requires OIDC)
|
|
static const coreApiUrl = String.fromEnvironment(
|
|
'CORE_API_URL',
|
|
defaultValue: 'http://192.168.86.149:8083',
|
|
);
|
|
|
|
/// Tatlock API base URL
|
|
/// - LAN default: No auth required
|
|
/// - Production: https://tatlock.schweitz.net (requires OIDC)
|
|
static const tatlockApiUrl = String.fromEnvironment(
|
|
'TATLOCK_API_URL',
|
|
defaultValue: 'http://192.168.86.149:8000',
|
|
);
|
|
|
|
/// Authentik OIDC discovery URL
|
|
static const authDiscoveryUrl = String.fromEnvironment(
|
|
'AUTH_DISCOVERY_URL',
|
|
defaultValue:
|
|
'https://auth.schweitz.net/application/o/tatlock-ui/.well-known/openid-configuration',
|
|
);
|
|
|
|
/// Authentik client ID
|
|
static const authClientId = String.fromEnvironment(
|
|
'AUTH_CLIENT_ID',
|
|
defaultValue: 'tatlock-ui',
|
|
);
|
|
|
|
/// Authentik redirect URI scheme
|
|
static const authRedirectScheme = String.fromEnvironment(
|
|
'AUTH_REDIRECT_SCHEME',
|
|
defaultValue: 'net.schweitz.tatlock',
|
|
);
|
|
|
|
/// Whether running in debug mode
|
|
static const isDebug = bool.fromEnvironment('DEBUG', defaultValue: false);
|
|
|
|
/// Whether auth is required (false for LAN development)
|
|
static bool get requiresAuth =>
|
|
coreApiUrl.contains('schweitz.net') ||
|
|
tatlockApiUrl.contains('schweitz.net');
|
|
}
|