From 7accc596c75050fa28fc0670686108233af5e502 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 24 Apr 2023 16:29:24 -0400 Subject: [PATCH] =?UTF-8?q?V=C3=A9rifier=20existence=20de=20buckets=20avan?= =?UTF-8?q?t=20de=20seed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Continue silencieusement si tout existe déjà --- cmd/server.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/server.go b/cmd/server.go index fb4669c..4e7d2ad 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -181,6 +181,17 @@ func handleV1Seed(c echo.Context) error { var new_buckets []string for _, bucket := range documents_buckets { + exists, err := client.BucketExists(context.Background(), bucket) + if err != nil { + return c.JSON(http.StatusInternalServerError, map[string]string{ + "message": "Error during minio#BucketExists", + }) + } + + if exists { + continue + } + if err = client.MakeBucket(context.Background(), bucket, minio.MakeBucketOptions{}); err != nil { return c.JSON(http.StatusInternalServerError, map[string]string{ "message": "Error during minio#MakeBucket",