GetCredentials get all the stored credentials
()
| 76 | |
| 77 | // GetCredentials get all the stored credentials |
| 78 | func GetCredentials() (*model.Credential, error) { |
| 79 | filePath := getAccountConfigPath() |
| 80 | yamlFile, err := file.File.ReadFile(filePath) |
| 81 | if err != nil { |
| 82 | logrus.Errorf("error getting credential unable to read accounts config file - %s", err.Error()) |
| 83 | return nil, err |
| 84 | } |
| 85 | |
| 86 | credential := new(model.Credential) |
| 87 | if err := yaml.Unmarshal(yamlFile, credential); err != nil { |
| 88 | logrus.Errorf("error getting credential unable to unmarshal accounts config file - %s", err.Error()) |
| 89 | return nil, err |
| 90 | } |
| 91 | return credential, nil |
| 92 | } |
no test coverage detected