Skip to content

Commit

Permalink
fix(bridge-history-api): change redis config (#1062)
Browse files Browse the repository at this point in the history
Co-authored-by: colinlyguo <[email protected]>
  • Loading branch information
colinlyguo and colinlyguo authored Dec 29, 2023
1 parent 693974d commit fdb71dd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
12 changes: 9 additions & 3 deletions bridge-history-api/cmd/api/app/app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"crypto/tls"
"fmt"
"os"
"os/signal"
Expand Down Expand Up @@ -52,11 +53,16 @@ func action(ctx *cli.Context) error {
log.Error("failed to close db", "err", err)
}
}()
redisClient := redis.NewClient(&redis.Options{
opts := &redis.Options{
Addr: cfg.Redis.Address,
Username: cfg.Redis.Username,
Password: cfg.Redis.Password,
DB: cfg.Redis.DB,
})
}
// Production Redis service has enabled transit_encryption.
if !cfg.Redis.Local {
opts.TLSConfig = &tls.Config{MinVersion: tls.VersionTLS12}
}
redisClient := redis.NewClient(opts)
api.InitController(db, redisClient)

router := gin.Default()
Expand Down
3 changes: 2 additions & 1 deletion bridge-history-api/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
},
"redis": {
"address": "localhost:6379",
"username": "default",
"password": "",
"db": 0
"local": true
}
}
2 changes: 2 additions & 0 deletions bridge-history-api/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ type LayerConfig struct {
// RedisConfig redis config
type RedisConfig struct {
Address string `json:"address"`
Username string `json:"username"`
Password string `json:"password"`
DB int `json:"db"`
Local bool `json:"local"`
}

// Config is the configuration of the bridge history backend
Expand Down
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.3.45"
var tag = "v4.3.46"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down

0 comments on commit fdb71dd

Please sign in to comment.