32 lines
1.2 KiB
Dart
32 lines
1.2 KiB
Dart
class EnvConfig {
|
||
static const String environment = String.fromEnvironment(
|
||
'ENV',
|
||
defaultValue: 'prod',
|
||
);
|
||
|
||
static String get sentryDsn {
|
||
// 根据环境切换 DSN(去 Sentry 后台创建两个项目:Test 和 Prod)
|
||
if (environment == 'prod') {
|
||
return 'https://d5fdda78335793935593efa3f4ed11bb@o4510984107261952.ingest.de.sentry.io/4510984527937616';
|
||
}
|
||
return 'https://1a72051f8ac6c21cde96ded18a318217@o4510984107261952.ingest.de.sentry.io/4510984468824144';
|
||
}
|
||
|
||
static bool get isProduction => environment == 'prod';
|
||
|
||
// ─── 服务器 IP(测试/生产共用同一台机器) ───
|
||
static const String serverHost = '1.95.137.212';
|
||
|
||
// ─── TCP 控制长连接 ───
|
||
static String get tcpIp => serverHost;
|
||
static int get tcpPort => isProduction ? 9001 : 59004;
|
||
|
||
// ─── HTTP 接口 ───
|
||
static int get httpPort => isProduction ? 8081 : 59003;
|
||
static String get baseUrl => 'http://$serverHost:$httpPort';
|
||
|
||
// ─── MQTT(一方后端:任务消息 / 割草机实时状态,prod=1883 / test=59007)───
|
||
// 注:第三方无人机 OSD(droneOsd,WebSocket 8083)不纳入环境管理,保持硬编码
|
||
static int get mqttPort => isProduction ? 1883 : 59007;
|
||
}
|