29 lines
806 B
Go
29 lines
806 B
Go
|
package setup
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"forge.cadoles.com/cadoles/bouncer/internal/config"
|
||
|
"forge.cadoles.com/cadoles/bouncer/internal/store"
|
||
|
redisStore "forge.cadoles.com/cadoles/bouncer/internal/store/redis"
|
||
|
"github.com/redis/go-redis/v9"
|
||
|
)
|
||
|
|
||
|
func NewProxyRepository(ctx context.Context, conf config.RedisConfig) (store.ProxyRepository, error) {
|
||
|
rdb := redis.NewUniversalClient(&redis.UniversalOptions{
|
||
|
Addrs: conf.Adresses,
|
||
|
MasterName: string(conf.Master),
|
||
|
})
|
||
|
|
||
|
return redisStore.NewProxyRepository(rdb), nil
|
||
|
}
|
||
|
|
||
|
func NewLayerRepository(ctx context.Context, conf config.RedisConfig) (store.LayerRepository, error) {
|
||
|
rdb := redis.NewUniversalClient(&redis.UniversalOptions{
|
||
|
Addrs: conf.Adresses,
|
||
|
MasterName: string(conf.Master),
|
||
|
})
|
||
|
|
||
|
return redisStore.NewLayerRepository(rdb), nil
|
||
|
}
|