Lot 3 (4/5) : API admin S3, variables S3_*, tests et documentation

GET/PUT /api/admin/s3 et POST /api/admin/s3/test (administrateurs) ;
S3_ENDPOINT, S3_REGION, S3_BUCKET, S3_ACCESS_KEY, S3_SECRET_KEY (_FILE),
S3_INSECURE ; miniatures S3 sous DATA_DIR/.s3cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNfwm4pfYR9C914C2EeiuB
This commit is contained in:
claude BotandClaude Opus 5.5 committed 2026-11-20 18:05:17 +01:00
1 parent 53972f9762
commit e79a813272
6 files changed
+95

No files matched your search

+11
View File
@@ -13,6 +13,7 @@ import (
"os"
"os/signal"
"path"
"path/filepath"
"strconv"
"strings"
"syscall"
@@ -162,6 +163,16 @@ func main() {
slog.Info("catalogue PostgreSQL branché")
}
spaces.MaxUpload = envInt("MAX_UPLOAD_MB", 0) << 20 // 0 : illimité
// Racine S3 (Garage ou S3 compatible) : variables S3_* et/ou interface
// d'administration ; exige le catalogue PostgreSQL.
spaces.ConfigureS3(ctx, storage.S3Config{
Endpoint: env("S3_ENDPOINT", ""),
Region: env("S3_REGION", ""),
Bucket: env("S3_BUCKET", ""),
AccessKey: secretEnv("S3_ACCESS_KEY"),
SecretKey: secretEnv("S3_SECRET_KEY"),
Insecure: envBool("S3_INSECURE", false),
}, filepath.Join(dataDir, ".s3cache"))
mode := strings.ToLower(env("AUTH_MODE", "local"))
handler := (&api.Handler{Store: store, Spaces: spaces, Mode: mode, Version: version}).Init()