[BREAKING] Changer Config.Server.Buckets à un map[string]string #98

Merged
vlbeaudoin merged 4 commits from feature/config-bucket-displayname into main 2023-08-15 16:02:10 -04:00
Showing only changes of commit 9bcf49b5e9 - Show all commits

View file

@ -72,16 +72,16 @@ func HandleV1BucketList(c echo.Context) error {
})
}
var buckets []string
var buckets = make(map[string]string)
for _, bucket_name := range cfg.Server.Documents.Buckets {
for bucket_name, bucket_display_name := range cfg.Server.Documents.Buckets {
exists, err := mediaClient.MinioClient.BucketExists(context.Background(), bucket_name)
if err != nil {
return c.JSON(http.StatusInternalServerError, "Error during minio#BucketExists")
}
if exists {
buckets = append(buckets, bucket_name)
buckets[bucket_name] = bucket_display_name
}
}
@ -99,7 +99,7 @@ func HandleV1BucketRead(c echo.Context) error {
bucket := c.Param("bucket")
allowed := false
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
for bucket_allowed := range cfg.Server.Documents.Buckets {
if bucket == bucket_allowed {
allowed = true
}
@ -171,7 +171,7 @@ func HandleV1DocumentCreate(c echo.Context) error {
}
allowed := false
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
for bucket_allowed := range cfg.Server.Documents.Buckets {
if bucket == bucket_allowed {
allowed = true
}
@ -240,7 +240,7 @@ func HandleV1DocumentRead(c echo.Context) error {
document := c.Param("document")
allowed := false
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
for bucket_allowed := range cfg.Server.Documents.Buckets {
if bucket == bucket_allowed {
allowed = true
}
@ -317,7 +317,7 @@ func HandleV1DocumentDelete(c echo.Context) error {
document := c.Param("document")
allowed := false
for _, bucket_allowed := range cfg.Server.Documents.Buckets {
for bucket_allowed := range cfg.Server.Documents.Buckets {
if bucket == bucket_allowed {
allowed = true
}