-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Hello,
I am trying to use this library and I found a problem with aws_credentials_provider:options().
According to the type declaration this type appear to be a nested map as shown below:
%% type declaration in aws_credentials_provider
%% -type options() :: #{provider() => map()}.
%% maybe like this
Options = #{
aws_credentials_file => #{
credential_path => "/path/to/aws/",
profile => "my_profile"
}
}.
However, in practice, the variable needs to be a flat map without a provider name, as shown in this example:
%% code in aws_credentials_file
-spec get_file_path(aws_credentials_provider:options()) -> {error, any()} | string().
get_file_path(Options) ->
case maps:get(credential_path, Options, undefined) of
undefined -> maybe_add_home("/.aws/");
Path -> Path
end.
Possible fixes:
- Keep the current code and modify
aws_credentials_provider:options()type to be a flat map to match current usage. - Change option values and usage to match the type declaration.
Method 1 is easier but makes it much harder to have different options for different providers in the future.
Method 2 is cleaner but breaks current library users, though some compatibility compromises could be made.
If I could choose, I would take method 2 with special credentials_path and profile options to maintain compatibility for current aws_credentials_file users.
(Luckily, there are no other usage except for those two options in aws_credentials_file.)
Thank you!