Skip to content
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

rpc/auth/email: use region from builder response #94

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions proto/builder/builder.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions proto/builder/builder.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct SESSettings
+ go.field.name = AccessRoleARN
- sourceARN: string
+ go.field.name = SourceARN
- region: string

enum EmailTemplateType: uint8
- UNKNOWN
Expand Down
1 change: 1 addition & 0 deletions rpc/auth/email/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (p *AuthProvider) InitiateAuth(
if tpl.SesConfig != nil {
msg.SourceARN = tpl.SesConfig.SourceARN
msg.AccessRoleARN = tpl.SesConfig.AccessRoleARN
msg.Region = tpl.SesConfig.Region
}

if err := p.Sender.Send(ctx, msg); err != nil {
Expand Down
1 change: 1 addition & 0 deletions rpc/auth/email/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Message struct {
Source string
SourceARN string
AccessRoleARN string
Region string
}

type Sender interface {
Expand Down
4 changes: 3 additions & 1 deletion rpc/auth/email/ses.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ func (s *sesSender) Send(ctx context.Context, msg *Message) error {
creds := stscreds.NewAssumeRoleProvider(stsClient, accessRoleARN)
awsCfg.Credentials = aws.NewCredentialsCache(creds)
}
if s.cfg.Region != "" {
if msg.Region != "" {
awsCfg.Region = msg.Region
} else if s.cfg.Region != "" {
awsCfg.Region = s.cfg.Region
}

Expand Down