Ajouter framework de documentation #35

Merged
vlbeaudoin merged 10 commits from feature/minio into main 2023-04-24 16:44:33 -04:00
2 changed files with 7 additions and 8 deletions
Showing only changes of commit a3287768ad - Show all commits

View file

@ -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)

View file

@ -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
}