ff32c8a845
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.3 KiB
Dart
48 lines
1.3 KiB
Dart
/// 集中管理应用配置,通过 --dart-define=KEY=value 注入环境变量
|
|
///
|
|
/// 开发默认值:http://localhost:8080
|
|
/// 生产部署示例:flutter run \
|
|
/// --dart-define=BASE_URL=http://192.168.1.100:8080 \
|
|
/// --dart-define=SHOP_NAME=强朋友名酒行 \
|
|
/// --dart-define=SHOP_ADDRESS=贵州省贵阳市云岩区中华北路88号 \
|
|
/// --dart-define=SHOP_PHONE=0851-12345678
|
|
class AppConfig {
|
|
const AppConfig._();
|
|
|
|
static const _baseUrl = String.fromEnvironment(
|
|
'BASE_URL',
|
|
defaultValue: 'http://localhost:8080',
|
|
);
|
|
|
|
static const _publicUrl = String.fromEnvironment(
|
|
'PUBLIC_URL',
|
|
defaultValue: 'http://localhost:8081',
|
|
);
|
|
|
|
static const shopName = String.fromEnvironment(
|
|
'SHOP_NAME',
|
|
defaultValue: '酒库管理系统',
|
|
);
|
|
|
|
static const shopAddress = String.fromEnvironment(
|
|
'SHOP_ADDRESS',
|
|
defaultValue: '',
|
|
);
|
|
|
|
static const shopPhone = String.fromEnvironment(
|
|
'SHOP_PHONE',
|
|
defaultValue: '',
|
|
);
|
|
|
|
static const aboutUrl = String.fromEnvironment(
|
|
'ABOUT_URL',
|
|
defaultValue: 'https://jiu.51yanmei.com',
|
|
);
|
|
|
|
static String get baseUrl => _baseUrl;
|
|
static String get apiBaseUrl => '$_baseUrl/api/v1';
|
|
static String get healthUrl => '$_baseUrl/health';
|
|
static String get versionUrl => '$_baseUrl/version';
|
|
static String get publicBaseUrl => _publicUrl;
|
|
}
|