Skip to content

Commit 545b002

Browse files
committed
rpc/auth/email: use region from builder response
1 parent 58897c6 commit 545b002

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

rpc/auth/email/provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func (p *AuthProvider) InitiateAuth(
119119
if tpl.SesConfig != nil {
120120
msg.SourceARN = tpl.SesConfig.SourceARN
121121
msg.AccessRoleARN = tpl.SesConfig.AccessRoleARN
122+
msg.Region = tpl.SesConfig.Region
122123
}
123124

124125
if err := p.Sender.Send(ctx, msg); err != nil {

rpc/auth/email/sender.go

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Message struct {
1212
Source string
1313
SourceARN string
1414
AccessRoleARN string
15+
Region string
1516
}
1617

1718
type Sender interface {

rpc/auth/email/ses.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ func (s *sesSender) Send(ctx context.Context, msg *Message) error {
3636
creds := stscreds.NewAssumeRoleProvider(stsClient, accessRoleARN)
3737
awsCfg.Credentials = aws.NewCredentialsCache(creds)
3838
}
39-
if s.cfg.Region != "" {
39+
if msg.Region != "" {
40+
awsCfg.Region = msg.Region
41+
} else if s.cfg.Region != "" {
4042
awsCfg.Region = s.cfg.Region
4143
}
4244

0 commit comments

Comments
 (0)