签入脚本
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
"easygoadmin/internal/middleware"
|
||||
)
|
||||
|
||||
// ctxLog 启动期提示
|
||||
// 以警告级别输出启动阶段的提示信息,便于排查依赖接线缺失
|
||||
func ctxLog(ctx context.Context, msg string) {
|
||||
g.Log().Warning(ctx, msg)
|
||||
}
|
||||
|
||||
// wireDependencies 中间件依赖接线
|
||||
//
|
||||
// 各业务包在 init() 中通过 SetXxx 完成注册(见 internal/logic/auth、internal/logic/system),
|
||||
// 此处仅做启动期校验与日志。
|
||||
func wireDependencies(ctx context.Context) {
|
||||
// 由业务包 init 注册:
|
||||
// middleware.SetIdentityLoader(authlogic.LoadIdentity) // internal/logic/auth
|
||||
// middleware.SetTenantLoader(systemlogic.LoadTenant) // internal/logic/system
|
||||
// middleware.SetLogSink(monitorlogic.SaveOperationLog) // internal/logic/monitor
|
||||
if middleware.IdentityLoader == nil {
|
||||
ctxLog(ctx, "IdentityLoader 未注册(认证模块尚未接入)")
|
||||
}
|
||||
if middleware.TenantLoader == nil {
|
||||
ctxLog(ctx, "TenantLoader 未注册(租户校验将跳过)")
|
||||
}
|
||||
if middleware.LogSink == nil {
|
||||
ctxLog(ctx, "LogSink 未注册(操作日志仅输出到调试日志)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user