naftulikay / aws-env

A utility script for exporting an AWS profile as environment variables.
Other
56 stars 10 forks source link

Safely handle missing credentials.d folder #27

Closed bltavares closed 1 year ago

bltavares commented 1 year ago

The $HOME/.aws/credentials.d folder is not required to exist, as all credential configurations can be defined on $HOME/.aws/credentials instead.

The early return with the ? operator caused the binary to fail if the optional folder did not exist, but worked if the folder existed but was empty.

This commit refactors the code the avoid crashing when the $HOME/.aws/credentials.d does not exist.

It is collecting into a Vector instead of chaining the streams as it would required Boxed Streams to switch between ReadDirStream and stream::empty in case of an Err.

This fixes #26

naftulikay commented 1 year ago

@bltavares Thank you so much for your fix here! I haven't had much time to fix this nagging issue and I and other users are very grateful for your work. I will be releasing 2.0.1 shortly to include this fix and will mention you in the release notes.

bltavares commented 1 year ago

No problem at all. I'm glad to help :)