ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Skeleton contracts / contracts (pull_request) Blocked by required conditions

Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
This commit is contained in:
2026-12-02 23:08:27 +03:00
parent 20afc2c790
commit 2f2047909f
182 changed files with 15169 additions and 90 deletions
+32
View File
@@ -0,0 +1,32 @@
package redis
import (
"context"
"fmt"
"log/slog"
"time"
goredis "github.com/redis/go-redis/v9"
)
func New(ctx context.Context, log *slog.Logger, url string) (*goredis.Client, error) {
opts, err := goredis.ParseURL(url)
if err != nil {
return nil, fmt.Errorf("parse redis url: %w", err)
}
opts.DialTimeout = 1 * time.Second
opts.ReadTimeout = 200 * time.Millisecond
opts.WriteTimeout = 200 * time.Millisecond
opts.MaxRetries = -1
client := goredis.NewClient(opts)
pingCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
defer cancel()
if err := client.Ping(pingCtx).Err(); err != nil {
log.Warn("redis unavailable, running without cache", "error", err)
}
return client, nil
}