16 lines
409 B
Go
16 lines
409 B
Go
package setup
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.cadoles.com/cadoles/bouncer/internal/config"
|
|
"forge.cadoles.com/cadoles/bouncer/internal/lock"
|
|
"forge.cadoles.com/cadoles/bouncer/internal/lock/redis"
|
|
)
|
|
|
|
func SetupLocker(ctx context.Context, conf *config.Config) (lock.Locker, error) {
|
|
client := newRedisClient(conf.Redis)
|
|
locker := redis.NewLocker(client, int(conf.Redis.LockMaxRetries))
|
|
return locker, nil
|
|
}
|