fix(config): 移除代码中的 app_version 引用,完成版本管理统一
- config.rs: 移除 AppConfig.app_version 字段和日志输出
- main.rs: 移除 APP_VERSION 环境变量设置
- models.rs: 移除 AppState.app_version 字段
版本号现统一使用 Cargo.toml 中的 env!("CARGO_PKG_VERSION")
This commit is contained in:
@@ -14,7 +14,6 @@ pub struct AppConfig {
|
||||
pub ssl_key_path: String,
|
||||
pub ssl_cert_path: String,
|
||||
pub rust_log: String,
|
||||
pub app_version: String,
|
||||
pub environment: String,
|
||||
pub free_user_data_limit: i32,
|
||||
pub server_host: String,
|
||||
@@ -82,11 +81,7 @@ impl AppConfig {
|
||||
let app_config: AppConfig = toml::from_str(&settings.to_string())
|
||||
.map_err(|e| format!("配置反序列化失败: {}", e))?;
|
||||
|
||||
tracing::info!(
|
||||
"配置加载成功,环境={},app_version={}",
|
||||
app_config.environment,
|
||||
app_config.app_version
|
||||
);
|
||||
tracing::info!("配置加载成功,环境={}", app_config.environment);
|
||||
|
||||
Ok(app_config)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,6 @@ async fn main() -> std::io::Result<()> {
|
||||
std::env::set_var("SSL_CERT_PATH", &app_config.ssl_cert_path);
|
||||
std::env::set_var("RUST_LOG", &app_config.rust_log);
|
||||
std::env::set_var("FREE_USER_DATA_LIMIT", app_config.free_user_data_limit.to_string());
|
||||
std::env::set_var("APP_VERSION", &app_config.app_version);
|
||||
}
|
||||
|
||||
// 初始化文件日志(JSON 格式,带轮转)
|
||||
|
||||
@@ -337,7 +337,6 @@ pub struct AppState {
|
||||
pub wechat_appid: String,
|
||||
pub wechat_secret: String,
|
||||
pub free_user_data_limit: i32,
|
||||
pub app_version: String,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
@@ -352,8 +351,6 @@ impl AppState {
|
||||
free_user_data_limit: std::env::var("FREE_USER_DATA_LIMIT")
|
||||
.map(|v| v.parse().unwrap_or(20))
|
||||
.unwrap_or(20),
|
||||
app_version: std::env::var("APP_VERSION")
|
||||
.unwrap_or_else(|_| "unknown".to_string()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user