lab4: исправления по ревью

This commit is contained in:
Vladislav Kunetskiy
2026-10-21 23:25:11 +03:00
parent 3389c6c900
commit e9f0fde6f2
32 changed files with 451 additions and 131 deletions
+5 -1
View File
@@ -54,7 +54,7 @@ type S3 struct {
MaxUploadBytes int64 `mapstructure:"max_upload_bytes" validate:"required,gt=0,lte=10485760"`
MaxImagePixels int64 `mapstructure:"max_image_pixels" validate:"required,gt=0,lte=40000000"`
PresignTTL time.Duration `mapstructure:"presign_ttl" validate:"required,gt=0"`
PresignTTL time.Duration `mapstructure:"presign_ttl" validate:"required,gt=0,lte=168h"`
SweepInterval time.Duration `mapstructure:"sweep_interval" validate:"required,gt=0"`
SweepGrace time.Duration `mapstructure:"sweep_grace" validate:"required,gt=0"`
}
@@ -229,6 +229,10 @@ func (c Config) validateDependencies() error {
return errors.New("validate config: cache.enabled requires redis.enabled")
}
if c.S3.SweepGrace <= c.S3.PresignTTL {
return errors.New("validate config: s3.sweep_grace must exceed s3.presign_ttl")
}
return nil
}