Browse Source

config,context

master
dark 7 months ago
parent
commit
2710388e33
  1. 3
      api/config.tpl
  2. 2
      api/context.tpl

3
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"`

2
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 {

Loading…
Cancel
Save