From 6f3ce84c2952e7384efe7fcfa24c9ea786d07849 Mon Sep 17 00:00:00 2001 From: Sjeng Pho Date: Thu, 22 Dec 2022 14:05:53 +0100 Subject: [PATCH] Support V10 generated config --- pkg/credentials/file_minio_client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/credentials/file_minio_client.go b/pkg/credentials/file_minio_client.go index ccacc9d11..e4c0f6717 100644 --- a/pkg/credentials/file_minio_client.go +++ b/pkg/credentials/file_minio_client.go @@ -113,6 +113,7 @@ type hostConfig struct { type config struct { Version string `json:"version"` Hosts map[string]hostConfig `json:"hosts"` + Aliases map[string]hostConfig `json:"aliases"` } // loadAliass loads from the file pointed to by shared credentials filename for alias. @@ -129,5 +130,10 @@ func loadAlias(filename, alias string) (hostConfig, error) { if err = json.Unmarshal(configBytes, cfg); err != nil { return hostConfig{}, err } + + if cfg.Version == "10" { + return cfg.Aliases[alias], nil + } + return cfg.Hosts[alias], nil }