Automattic / hostmgr

A tool for managing macOS VM hosts
Mozilla Public License 2.0
8 stars 3 forks source link

Support `~/.aws/config` file parsing #93

Closed AliSoftware closed 2 months ago

AliSoftware commented 3 months ago

What

Especially so that even if region is not defined in ~/.aws/credentials but is defined in ~/.aws/config, we can still create AWSCredentials with that region value.

Fixes https://github.com/Automattic/hostmgr/issues/83

How

The parsing which was previously done by the AWSCredentialsFileParser class is now handled via:

I've then updated the tests to account for more scenarios combining those.

[!Note]
While the ~/.aws/credentials and ~/.aws/config files are very similar, they use slightly different format for profile sections, with the ~/.aws/config file listing profiles as [profile <profilename>]—except for the special [default] one—and potentially having other section types, like [services <…>] or [sso-session <…>] too.

AliSoftware commented 2 months ago

ping @jkmassel for another review 🙂 (especially to lift the "change requested" blocker if you agree that I addressed all your latest feedback)