MCPcopy Create free account
hub / github.com/barnybug/cli53 / loadAWSProfileSettings

Function loadAWSProfileSettings

util.go:176–198  ·  view source on GitHub ↗
(profile string)

Source from the content-addressed store, hash-verified

174}
175
176func loadAWSProfileSettings(profile string) (awsProfileSettings, bool, error) {
177 settings := awsProfileSettings{Name: profile}
178 found := false
179
180 for _, path := range sharedConfigFilesForDebug() {
181 file, err := os.Open(path)
182 if err != nil {
183 if errors.Is(err, os.ErrNotExist) {
184 continue
185 }
186 return awsProfileSettings{}, false, err
187 }
188
189 fileFound, fileErr := parseAWSConfigProfile(file, profile, &settings)
190 _ = file.Close()
191 if fileErr != nil {
192 return awsProfileSettings{}, false, fmt.Errorf("parse %s: %w", path, fileErr)
193 }
194 found = found || fileFound
195 }
196
197 return settings, found, nil
198}
199
200func parseAWSConfigProfile(file *os.File, profile string, settings *awsProfileSettings) (bool, error) {
201 scanner := bufio.NewScanner(file)

Callers 2

Calls 2

parseAWSConfigProfileFunction · 0.85

Tested by 1