Ajouter framework de documentation #35
2 changed files with 7 additions and 8 deletions
|
@ -148,13 +148,12 @@ func handleV1Health(c echo.Context) error {
|
||||||
|
|
||||||
message := make(map[string]interface{}, len(documents_buckets))
|
message := make(map[string]interface{}, len(documents_buckets))
|
||||||
|
|
||||||
for _, bucket := range documents_buckets {
|
for _, bucket_name := range documents_buckets {
|
||||||
|
exists, err := client.BucketExists(bucket_name)
|
||||||
exists, err := client.BucketExists(bucket)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c.JSON(http.StatusInternalServerError, err)
|
return c.JSON(http.StatusInternalServerError, err)
|
||||||
}
|
}
|
||||||
message[bucket] = exists
|
message[bucket_name] = exists
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, message)
|
return c.JSON(http.StatusOK, message)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
type Client struct {
|
type Client struct {
|
||||||
Endpoint, AccessKeyID, SecretAccessKey string
|
Endpoint, AccessKeyID, SecretAccessKey string
|
||||||
UseSSL bool
|
UseSSL bool
|
||||||
MongoClient *minio.Client
|
MinioClient *minio.Client
|
||||||
Context context.Context
|
Context context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ func NewClient(buckets []string, endpoint, accessKeyID, secretAccessKey string,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize minio client object
|
// 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, ""),
|
Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
|
||||||
Secure: useSSL,
|
Secure: useSSL,
|
||||||
})
|
})
|
||||||
|
@ -33,13 +33,13 @@ func NewClient(buckets []string, endpoint, accessKeyID, secretAccessKey string,
|
||||||
return &c, err
|
return &c, err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.MongoClient = mongo_client
|
c.MinioClient = minio_client
|
||||||
|
|
||||||
return &c, nil
|
return &c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) BucketExists(bucketName string) (bool, error) {
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue