From a3287768adf03e8e09c1e29a8b1547bf3f1a3e13 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 21 Apr 2023 17:11:06 -0400 Subject: [PATCH] Replace MongoClient with MinioClient (was typo) Use bucket_name instead of bucket in handleV1Health --- cmd/server.go | 7 +++---- data/data.go | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index a1856c9..f7e323c 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -148,13 +148,12 @@ func handleV1Health(c echo.Context) error { message := make(map[string]interface{}, len(documents_buckets)) - for _, bucket := range documents_buckets { - - exists, err := client.BucketExists(bucket) + for _, bucket_name := range documents_buckets { + exists, err := client.BucketExists(bucket_name) if err != nil { return c.JSON(http.StatusInternalServerError, err) } - message[bucket] = exists + message[bucket_name] = exists } return c.JSON(http.StatusOK, message) diff --git a/data/data.go b/data/data.go index 8d29b9a..4c6fd2e 100644 --- a/data/data.go +++ b/data/data.go @@ -11,7 +11,7 @@ import ( type Client struct { Endpoint, AccessKeyID, SecretAccessKey string UseSSL bool - MongoClient *minio.Client + MinioClient *minio.Client Context context.Context } @@ -25,7 +25,7 @@ func NewClient(buckets []string, endpoint, accessKeyID, secretAccessKey string, } // Initialize minio client object - mongo_client, err := minio.New(endpoint, &minio.Options{ + minio_client, err := minio.New(endpoint, &minio.Options{ Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""), Secure: useSSL, }) @@ -33,13 +33,13 @@ func NewClient(buckets []string, endpoint, accessKeyID, secretAccessKey string, return &c, err } - c.MongoClient = mongo_client + c.MinioClient = minio_client return &c, nil } func (c *Client) BucketExists(bucketName string) (bool, error) { - result, err := c.MongoClient.BucketExists(c.Context, bucketName) + result, err := c.MinioClient.BucketExists(c.Context, bucketName) if err != nil { return false, err }