loadProfiles loads from the file pointed to by shared credentials filename for profile. The credentials retrieved from the profile will be returned or error. Error will be returned if it fails to read from the file, or the data is invalid.
(filename, profile string)
| 155 | // The credentials retrieved from the profile will be returned or error. Error will be |
| 156 | // returned if it fails to read from the file, or the data is invalid. |
| 157 | func loadProfile(filename, profile string) (*ini.Section, error) { |
| 158 | config, err := ini.Load(filename) |
| 159 | if err != nil { |
| 160 | return nil, err |
| 161 | } |
| 162 | iniProfile, err := config.GetSection(profile) |
| 163 | if err != nil { |
| 164 | return nil, err |
| 165 | } |
| 166 | return iniProfile, nil |
| 167 | } |