From 6c858667b6c6c6220831d3f303563a0800c354fe Mon Sep 17 00:00:00 2001 From: Booker Date: Fri, 29 May 2026 18:10:29 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=92=8C=E5=85=BC=E5=AE=B9=E6=80=A7=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E4=BC=98=E5=8C=96=20H5=20=E7=BA=BF=E8=B7=AF?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/config/app_config.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index 30a1c3f..320af2f 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -12,6 +12,12 @@ class H5Line { Uri get uri => Uri.parse(url); } +enum Environment { + development, + staging, + production, +} + class AppConfig { static const String appName = '本地打包'; static const String appLogo = ''; @@ -25,11 +31,19 @@ class AppConfig { static const String _bootstrapH5LineUrl = String.fromEnvironment( 'BOOTSTRAP_H5_LINE_URL', defaultValue: 'https://h5-test.imharry.work/'); + static const Environment currentEnvironment = Environment.production; + // Compatibility for the packaging service's legacy domain rewrite step. + static final Map> _environmentHosts = { + Environment.production: [ + _bootstrapH5LineUrl, + ], + }; static final Random _wildcardRandom = Random.secure(); static List get h5Lines { final configuredUrls = _dartDefinedH5LineUrls.trim().isEmpty - ? _normalizedUniqueUrls(const [_bootstrapH5LineUrl]) + ? _normalizedUniqueUrls(_environmentHosts[currentEnvironment] ?? + const [_bootstrapH5LineUrl]) : _normalizedUniqueUrls(_dartDefinedH5LineUrls.split(',')); final urls = configuredUrls.isEmpty ? _normalizedUniqueUrls(const [_bootstrapH5LineUrl])