Skip to content

Commit

Permalink
Support V10 generated config (#1743)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtpho committed Dec 22, 2022
1 parent c712ba2 commit 8cfb4c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/credentials/file_minio_client.go
Expand Up @@ -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.
Expand All @@ -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
}

0 comments on commit 8cfb4c2

Please sign in to comment.