fix(core): 迁移修复 + 配置调整

- auth_state: 新增字段
- config/default.toml: 配置更新
- migration 078/082: 修复 SQL 语法
- state/main: 启动逻辑调整
This commit is contained in:
iven
2026-04-28 00:20:11 +08:00
parent e56cd73e49
commit 30f2452933
9 changed files with 89 additions and 12 deletions

View File

@@ -62,6 +62,8 @@ pub struct CorsConfig {
pub struct WechatConfig {
pub appid: String,
pub secret: String,
#[serde(default)]
pub dev_mode: bool,
}
#[derive(Debug, Clone, Deserialize)]

View File

@@ -207,7 +207,7 @@ async fn main() -> anyhow::Result<()> {
);
std::process::exit(1);
}
if config.wechat.appid == "__MUST_SET_VIA_ENV__" || config.wechat.secret == "__MUST_SET_VIA_ENV__" {
if !config.wechat.dev_mode && (config.wechat.appid == "__MUST_SET_VIA_ENV__" || config.wechat.secret == "__MUST_SET_VIA_ENV__") {
tracing::error!(
"微信凭据为默认占位值,拒绝启动。请设置环境变量 ERP__WECHAT__APPID 和 ERP__WECHAT__SECRET"
);

View File

@@ -57,6 +57,7 @@ impl FromRef<AppState> for erp_auth::AuthState {
default_tenant_id: state.default_tenant_id,
wechat_appid: state.config.wechat.appid.clone(),
wechat_secret: state.config.wechat.secret.clone(),
wechat_dev_mode: state.config.wechat.dev_mode,
redis: Some(state.redis.clone()),
}
}