fix: admin token in standalone mode (#3499)

* fix: performance issues with Kafka caused by encapsulating the MQ interface

* fix: admin token in standalone mode
This commit is contained in:
chao
2025-08-01 10:48:25 +08:00
committed by GitHub
parent c208c3789f
commit d817cb0ffd
2 changed files with 9 additions and 5 deletions
+5
View File
@@ -97,6 +97,11 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, cf
case BestSpeed:
r.Use(gzip.Gzip(gzip.BestSpeed))
}
if config.Standalone() {
r.Use(func(c *gin.Context) {
c.Set(authverify.CtxAdminUserIDsKey, cfg.Share.IMAdminUser.UserIDs)
})
}
r.Use(api.GinLogger(), prommetricsGin(), gin.RecoveryWithWriter(gin.DefaultErrorWriter, mw.GinPanicErr), mw.CorsHandler(),
mw.GinParseOperationID(), GinParseToken(rpcli.NewAuthClient(authConn)), setGinIsAdmin(cfg.Share.IMAdminUser.UserIDs))