Files
tongxunruanjian/mobile-next/lib/company/config/app_endpoints.dart
T

37 lines
1.1 KiB
Dart

/// 内网地址唯一入口。页面与 SDK 初始化不得再硬编码 IP/端口。
///
/// 仅本地联调:`--dart-define=AUTH_HOST=127.0.0.1` 可覆盖账号服务地址。
class AppEndpoints {
AppEndpoints._();
static const String host = String.fromEnvironment(
'SERVER_HOST',
defaultValue: '192.168.200.11',
);
static const String authHost = String.fromEnvironment(
'AUTH_HOST',
defaultValue: host,
);
static const int apiPort = 10002;
static const int wsPort = 10001;
static const int authPort = 10010;
static const int livekitPort = 17880;
static const String apiAddr = 'http://$host:$apiPort';
static const String wsAddr = 'ws://$host:$wsPort';
static const String authApiBase = 'http://$authHost:$authPort';
static const String livekitUrl = 'ws://$host:$livekitPort';
/// 写入官方 DataSp 的服务器配置键,供 Config.imApiUrl / imWsUrl 读取。
static Map<String, String> toServerConfig() => {
'serverIP': host,
'apiUrl': apiAddr,
'wsUrl': wsAddr,
'authUrl': authApiBase,
'chatTokenUrl': authApiBase,
'logLevel': '5',
};
}