refactor(config): 服务地址改为 dev/prod 配置文件与单个环境开关

启动时按环回、局域网、公网顺序探测地址,换网络后会静默切到别处,排查
困难。改为代码内一个布尔开关选择环境,地址分别放在 dev_config.dart 与
prod_config.dart,不再探测;调试条改地址后直接重载,不再重新探测。
release 构建若仍是开发开关会启动即报错,避免线上包连开发机。
This commit is contained in:
Zhou Weidong authored and trae-solo-agent committed 2026-10-29 10:44:50 +08:00
1 parent 57f84c45bd
commit a6d6b66d31
13 files changed
+101 -382

No files matched your search

+4 -4
View File
@@ -136,19 +136,19 @@ void main() {
});
test(
'should_use_probed_endpoint_when_client_was_created_before_probe',
'should_follow_runtime_endpoint_applied_after_client_creation',
() async {
const probedBaseUrl = 'http://probed.test:8081';
const runtimeBaseUrl = 'http://runtime.test:8081';
final adapter = FakeHttpAdapter(
(_) async => FakeHttpResponse(envelope(null)),
);
final client = ApiClient(adapter: adapter);
AppConfig.applyRuntimeBaseUrl(probedBaseUrl);
AppConfig.applyRuntimeBaseUrl(runtimeBaseUrl);
addTearDown(AppConfig.clearRuntimeBaseUrl);
await client.get('/app/home/feed');
expect(adapter.requests.single.uri.origin, probedBaseUrl);
expect(adapter.requests.single.uri.origin, runtimeBaseUrl);
},
);
}