-
-
Notifications
You must be signed in to change notification settings - Fork 10
RFC: add signature v4 #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c60691d
to
f800c60
Compare
|
) | ||
|
||
export class Credentials extends Context.Tag(`@effect-aws/signature-v4/Credentials`)<Credentials, Ref.Ref<Option.Option<AWSCredentialsRedacted>>>() { | ||
static layer = (credentials?: AWSCredentials) => Layer.effect(Credentials, Ref.make(redactCredentials(credentials))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Populate credentials with new value | ||
*/ | ||
yield* Credentials.pipe( | ||
Effect.andThen(Ref.set(Option.some(newCredentials))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you clarify why do you need Ref
I feel like using Ref with Layer is a bit off, it makes it impure.
I would rather use the globalValue
and 2 functions: withCredentials
and setCredentials
(hof and setter). see example here, however global value strips Credentials
as dependency and requires default value, which suits well if you use shell aws config or sso...
This is basic implementation for attaching AWS Signature v4 to HttpClientRequest
Usage example is somewhat along these lines: