Buckets : bouton Vider (objets et envois multipart inachevés)
L'API d'administration ne sait pas supprimer d'objets : le serveur passe par l'API S3 avec une clé temporaire (CreateKey + AllowBucketKey), supprime les objets par lots de 1000 (ListObjectsV2 + DeleteObjects, signature v4 en bibliothèque standard), nettoie les envois inachevés (CleanupIncompleteUploads, olderThanSecs 0) puis supprime la clé. Avancement diffusé en NDJSON (POST /api/buckets/empty?id=...). Confirmation par saisie du nom, interruption et reprise possibles. Nouvelle variable GARAGE_S3_API_URL (défaut : hôte admin, port 3900). Mock : API S3 minimale sur :3900. Tests : signature (exemple AWS) et vidage complet simulé. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LNfwm2bSk3o3YKYUP5P691
This commit is contained in:
1 parent
ea2058b6c1
commit
e21ef321f9
7 files changed
+278
-8
No files matched your search
@@ -51,6 +51,7 @@ type config struct {
|
||||
title string
|
||||
s3Endpoint string
|
||||
s3Region string
|
||||
s3URL *url.URL // API S3 vue du serveur (vidage des buckets), distincte de l'endpoint public
|
||||
cliBin string
|
||||
cliConfig string
|
||||
rpcHost string // GARAGE_RPC_HOST : [identifiant@]hôte:port
|
||||
@@ -91,6 +92,10 @@ func loadConfig() (*config, error) {
|
||||
return nil, fmt.Errorf("GARAGE_ADMIN_URL invalide")
|
||||
}
|
||||
c.adminURL = u
|
||||
s3 := env("GARAGE_S3_API_URL", "http://"+u.Hostname()+":3900")
|
||||
if c.s3URL, err = url.Parse(s3); err != nil || c.s3URL.Host == "" {
|
||||
return nil, fmt.Errorf("GARAGE_S3_API_URL invalide")
|
||||
}
|
||||
if d, err := time.ParseDuration(env("SESSION_TTL", "24h")); err == nil && d > 0 {
|
||||
c.sessionTTL = d
|
||||
}
|
||||
@@ -437,6 +442,7 @@ func (c *config) routes() http.Handler {
|
||||
mux.HandleFunc("POST /api/login", c.handleLogin)
|
||||
mux.HandleFunc("POST /api/logout", c.handleLogout)
|
||||
mux.HandleFunc("POST /api/cli", c.guard(c.handleCLI))
|
||||
mux.HandleFunc("POST /api/buckets/empty", c.guard(c.handleEmptyBucket))
|
||||
mux.Handle("/api/garage/", c.guard(c.garageProxy().ServeHTTP))
|
||||
mux.Handle("/", spa())
|
||||
return mux
|
||||
|
||||
Reference in new issue
Block a user