27 lines
775 B
Dart
27 lines
775 B
Dart
import 'dart:io';
|
|
|
|
/// Test environment flags aligned with [server/lib/env.dart] trading gates.
|
|
class TestEnv {
|
|
TestEnv._();
|
|
|
|
static bool get tradingEnabled =>
|
|
_bool('TRADING_ENABLED', defaultValue: false);
|
|
|
|
static bool get questionPipelineTestMode =>
|
|
_bool('QUESTION_PIPELINE_TEST_MODE', defaultValue: true);
|
|
|
|
static String? get databaseUrl =>
|
|
Platform.environment['TEST_DATABASE_URL'] ??
|
|
Platform.environment['DATABASE_URL'];
|
|
|
|
static bool get hasDatabase => databaseUrl != null && databaseUrl!.isNotEmpty;
|
|
|
|
static bool _bool(String key, {required bool defaultValue}) {
|
|
final String? raw = Platform.environment[key];
|
|
if (raw == null || raw.isEmpty) {
|
|
return defaultValue;
|
|
}
|
|
return raw == 'true' || raw == '1';
|
|
}
|
|
}
|