Skip to content

Commit

Permalink
KUBE-344: allow to pass crossplane as UA (#309)
Browse files Browse the repository at this point in the history
* KUBE-344: allow to pass crossplane as UA

* regenrate sdk

* Update castai/provider.go
  • Loading branch information
aldor007 authored May 14, 2024
1 parent f93dfbb commit 0880c17
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions castai/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package castai
import (
"context"
"fmt"
"os"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -73,6 +74,10 @@ func providerConfigure(version string) schema.ConfigureContextFunc {
apiToken := data.Get("api_token").(string)

agent := fmt.Sprintf("castai-terraform-provider/%v", version)
if addUA := os.Getenv("CASTAI_ADDITIONAL_USER_AGENT"); addUA != "" {
agent = fmt.Sprintf("%s %s", agent, addUA)
}

client, err := sdk.CreateClient(apiURL, apiToken, agent)
if err != nil {
return nil, diag.FromErr(err)
Expand Down

0 comments on commit 0880c17

Please sign in to comment.