lab4 done

This commit is contained in:
Khakimov Dmitrij
2026-10-28 22:41:10 +03:00
parent a7bedda183
commit dbc700fafe
75 changed files with 5611 additions and 227 deletions
+19
View File
@@ -10,6 +10,11 @@ import (
)
type Config struct {
S3Endpoint string
S3Bucket string
S3AccessKey string
S3SecretKey string
S3UseSSL bool
Port string
PostgresHost string
PostgresPort uint16
@@ -96,5 +101,19 @@ func Load() (Config, error) {
return c, fmt.Errorf("CURSOR_KEY must be 32 random bytes encoded as hex")
}
copy(c.CursorKey[:], decoded)
c.S3Endpoint = value("S3_ENDPOINT", "minio:9000")
c.S3Bucket = value("S3_BUCKET", "attachments")
c.S3UseSSL, err = strconv.ParseBool(value("S3_USE_SSL", "false"))
if err != nil {
return c, fmt.Errorf("invalid S3_USE_SSL")
}
c.S3AccessKey, err = secret("S3_ACCESS_KEY")
if err != nil {
return c, err
}
c.S3SecretKey, err = secret("S3_SECRET_KEY")
if err != nil {
return c, err
}
return c, nil
}