2024-03-27 17:47:39 +01:00
|
|
|
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) {
|
2024-09-23 15:16:30 +02:00
|
|
|
client := NewSharedClient(conf.Redis)
|
2024-04-05 10:30:34 +02:00
|
|
|
locker := redis.NewLocker(client, int(conf.Redis.LockMaxRetries))
|
2024-03-27 17:47:39 +01:00
|
|
|
return locker, nil
|
|
|
|
}
|