Skip to content

Commit

Permalink
[feature] Configure: Adds aws-oidc version to useragent (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Lopez authored Jul 23, 2020
1 parent 38afaa8 commit 5474c72
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/aws_config_client/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"

server "github.com/chanzuckerberg/aws-oidc/pkg/aws_config_server"
"github.com/chanzuckerberg/aws-oidc/pkg/util"
"github.com/chanzuckerberg/go-misc/oidc_cli/client"
"github.com/honeycombio/beeline-go"
"github.com/honeycombio/beeline-go/propagation"
Expand All @@ -24,6 +25,11 @@ func RequestConfig(
ctx, span := beeline.StartSpan(ctx, "get_aws_config")
defer span.Send()

ver, err := util.VersionString()
if err != nil {
return nil, err
}

req, err := http.NewRequest(http.MethodGet, configServiceURI, nil)
if err != nil {
return nil, errors.Wrapf(err, "could not create request for %s", configServiceURI)
Expand All @@ -33,6 +39,10 @@ func RequestConfig(
"Authorization",
fmt.Sprintf("BEARER %s", token.IDToken),
)
req.Header.Set(
"User-Agent",
fmt.Sprintf("aws-oidc/%s", ver),
)

span.SerializeHeaders()
req.Header.Add(
Expand Down

0 comments on commit 5474c72

Please sign in to comment.