Closed philipp-classen closed 5 months ago
Hi, yes, I think it's reasonable for that constructor to change and for the defaults to be the ENV vars, if set. Happy to merge a PR for that.
You are correct, as it stands now I don't think any of the config will auto configure off the ENV
Thanks!
There's a third party shard to handle the process of obtaining the credentials: https://github.com/y2k2mt/aws-credentials.cr With the credentials received, the remaining part in this shard is pretty simple: https://github.com/taylorfinnell/awscr-s3/pull/114
Thanks for creating the library! It works, but I ran into two issues. The first is merely of an observation, while the second is a question about the implementation of
X-Amz-Security-Token
, which looks incomplete.What I was trying to do is to list buckets like
aws s3 ls
. I'm using aws-vault and have the credentials available as environment variables.I was assuming the client would automatically default to the variables from the environment, as many libraries do. Have when setting them manually, I also ran into a problem. Here is what I tried:
It turns out that aws-vaul is generating temporary credentials: there is a
AWS_SECURITY_TOKEN
which has to be passed in theX-Amz-Security-Token
header. When I tested with non-temporary credentials, the code above worked.Regarding the security token, I did find it being implemented in the awscr-signer library in the Awscr::Signer::Signers::V4 class. But from awscr-s3, I did not see a way to pass the value. Thus, it is always
nil
, which explains why AWS fails with:When I change the code in line 17 from
to
it works.
My questions:
I'm using Crystal 1.4.1 and my shard.lock looks like that:
The environment is setup that I get from aws-vault looks like that (I think, the name of the environment variables is pretty standard):