Добавьте S3-вложения с дедупликацией и безопасной сверкой хранилищ

This commit is contained in:
2026-11-16 12:36:59 +03:00
parent b323f2dab9
commit d761861def
54 changed files with 5061 additions and 102 deletions
+10 -1
View File
@@ -15,6 +15,9 @@ import (
"time"
)
// Allow a 30s binary request, its independent 3s cleanup, and 5s margin.
const defaultShutdownTimeout = 38 * time.Second
type Logging struct {
Env string
Level slog.Level
@@ -43,6 +46,7 @@ type Config struct {
IdempotencyTTL time.Duration
DBMaxConns int32
DebugAddr string
S3 S3
}
type Migrate struct {
@@ -58,7 +62,7 @@ func Load(lookup Lookup) (Config, error) {
cfg := Config{
Host: "0.0.0.0",
Port: 8080,
ShutdownTimeout: 8 * time.Second,
ShutdownTimeout: defaultShutdownTimeout,
MaxBodyBytes: 64 * 1024,
SessionTTL: time.Hour,
DrainDelay: 2 * time.Second,
@@ -136,6 +140,11 @@ func Load(lookup Lookup) (Config, error) {
if cfg.SessionStoreURL, err = secret(lookup, "SESSION_STORE_URL_FILE"); err != nil {
return Config{}, err
}
if _, ok := lookup("S3_ENDPOINT"); ok {
if cfg.S3, err = LoadS3(lookup); err != nil {
return Config{}, err
}
}
return cfg, nil
}