Skip to content

Commit

Permalink
feat: add EXTRA_USER_AGENT env (#32)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Cyvoct <[email protected]>
  • Loading branch information
Sh4d1 authored Sep 11, 2020
1 parent 0699aa9 commit 4fbb854
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package driver
import (
"context"
"fmt"
"os"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -50,9 +51,14 @@ type controllerService struct {
}

func newControllerService(config *DriverConfig) controllerService {
userAgent := fmt.Sprintf("%s %s (%s)", DriverName, driverVersion, gitCommit)
if extraUA := os.Getenv(ExtraUserAgentEnv); extraUA != "" {
userAgent = userAgent + " " + extraUA
}

return controllerService{
config: config,
scaleway: scaleway.NewScaleway(fmt.Sprintf("%s %s (%s)", DriverName, driverVersion, gitCommit)),
scaleway: scaleway.NewScaleway(userAgent),
}
}

Expand Down
3 changes: 3 additions & 0 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const (
// DriverName is the official name for the Scaleway CSI plugin
DriverName = "csi.scaleway.com"
ZoneTopologyKey = "topology." + DriverName + "/zone"

// ExtraUserAgentEnv is the environment variable that adds some string at the end of the user agent
ExtraUserAgentEnv = "EXTRA_USER_AGENT"
)

// Mode represents the mode in which the CSI driver started
Expand Down

0 comments on commit 4fbb854

Please sign in to comment.