Skip to content

Commit

Permalink
Add ability to turn on credential chain loading verbose error
Browse files Browse the repository at this point in the history
Signed-off-by: Alvin Lin <[email protected]>
  • Loading branch information
alvinlin123 committed Mar 12, 2022
1 parent 1801c44 commit 722add7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func main() {
if v := os.Getenv("AWS_STS_REGIONAL_ENDPOINTS"); len(v) == 0 {
sessionConfig.STSRegionalEndpoint = endpoints.RegionalSTSEndpoint
}
sessionConfig.CredentialsChainVerboseErrors = aws.Bool(true)

sessionConfig.CredentialsChainVerboseErrors = aws.Bool(shouldLogSigning())

session, err := session.NewSession(&sessionConfig)
if err != nil {
Expand Down Expand Up @@ -99,7 +100,7 @@ func main() {
}

signer := v4.NewSigner(credentials, func(s *v4.Signer) {
if *logSinging || *debug {
if shouldLogSigning() {
s.Logger = awsLoggerAdapter{}
s.Debug = aws.LogDebugWithSigning
}
Expand Down Expand Up @@ -128,6 +129,10 @@ func main() {
)
}

func shouldLogSigning() bool {
return *logSinging || *debug
}

func roleSessionName() string {
suffix, err := os.Hostname()

Expand Down

0 comments on commit 722add7

Please sign in to comment.