refactor(env): centralize app environment detection

This commit is contained in:
2026-06-17 15:31:15 +08:00
parent 977c0905bd
commit a6ee0d5e24
4 changed files with 40 additions and 20 deletions
+3 -4
View File
@@ -4,8 +4,9 @@
* 通过环境变量配置后端服务地址与超时时间。
* 原始 Dart: lib/core/net/service_manager.dart
*/
import { AppEnvUtil, type AppEnv } from "@/utils/app-env";
export type AppEnv = "development" | "test" | "production";
export type { AppEnv };
export interface ApiConfig {
/** 后端 API 基础 URL(含协议) */
@@ -33,9 +34,7 @@ export class TimeoutConstants {
* 解析当前环境
*/
export function getAppEnv(): AppEnv {
const env = process.env.NEXT_PUBLIC_APP_ENV;
if (env === "production" || env === "test") return env;
return "development";
return AppEnvUtil.current;
}
/**