diff --git a/cache/redis/config.go b/cache/redis/config.go index 2557962..1a59b95 100644 --- a/cache/redis/config.go +++ b/cache/redis/config.go @@ -1,6 +1,6 @@ package redis -type Config struct { - Host string `env:"CACHE_HOST"` - Port uint16 `env:"CACHE_PORT"` +type RedisConfig struct { + CacheHost string `env:"CACHE_HOST"` + CachePort uint16 `env:"CACHE_PORT"` } diff --git a/cache/redis/connection.go b/cache/redis/connection.go index 46b1383..7e42f41 100644 --- a/cache/redis/connection.go +++ b/cache/redis/connection.go @@ -8,9 +8,9 @@ import ( "github.com/rs/zerolog/log" ) -func GetConnection(ctx context.Context, cfg Config) redis.UniversalClient { +func GetConnection(ctx context.Context, cfg RedisConfig) redis.UniversalClient { return redis.NewUniversalClient(&redis.UniversalOptions{ - Addrs: []string{fmt.Sprintf("%s:%d", cfg.Host, cfg.Port)}, + Addrs: []string{fmt.Sprintf("%s:%d", cfg.CacheHost, cfg.CachePort)}, DB: 0, OnConnect: func(ctx context.Context, cn *redis.Conn) error { log.Info().Msg("connected to the cache")