From 2710388e336132e71d8fbb842e1b8d092a159d34 Mon Sep 17 00:00:00 2001 From: dark Date: Sun, 13 Jul 2025 22:34:32 +0800 Subject: [PATCH] config,context --- api/config.tpl | 3 +++ api/context.tpl | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/config.tpl b/api/config.tpl index 81a8817..b2baa64 100644 --- a/api/config.tpl +++ b/api/config.tpl @@ -19,6 +19,9 @@ type Config struct { Port int `json:"port"` Password string `json:"password"` Database int `json:"database"` + TkDB int `json:"tkDB"` + CacheDB int `json:"cacheDB"` + CacheExpire int `json:"cacheExpire"` } Auth struct { AccessSecret string `json:"accessSecret"` diff --git a/api/context.tpl b/api/context.tpl index 5a7eb05..c35b068 100644 --- a/api/context.tpl +++ b/api/context.tpl @@ -30,7 +30,7 @@ func NewServiceContext(c {{.config}}) *ServiceContext { redisClient := redis.NewClient(&redis.Options{ Addr: fmt.Sprintf("%s:%d", c.Redis.Host, c.Redis.Port), Password: c.Redis.Password, // no password set - DB: c.Redis.DB, // use default DB + DB: c.Redis.TkDB, // use default DB }) _, err = redisClient.Ping(c.Context).Result() if err != nil {