Tibber pulse: set evcc version in user agent (#21217)
This commit is contained in:
parent
f0f88d5948
commit
3de3dcb1d7
1 changed files with 4 additions and 4 deletions
|
|
@ -22,11 +22,9 @@ func init() {
|
|||
}
|
||||
|
||||
func getUserAgent() string {
|
||||
evccVersion := util.Version
|
||||
graphqlClientVersion := "0.13.2+unknown"
|
||||
graphqlClientVersion := "unknown"
|
||||
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
evccVersion = baseVersion(info.Main.Version)
|
||||
for _, dep := range info.Deps {
|
||||
if dep.Path == "github.com/hasura/go-graphql-client" {
|
||||
graphqlClientVersion = baseVersion(dep.Version)
|
||||
|
|
@ -34,7 +32,7 @@ func getUserAgent() string {
|
|||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("evcc/%s hasura/go-graphql-client/%s", evccVersion, graphqlClientVersion)
|
||||
return fmt.Sprintf("evcc/%s hasura/go-graphql-client/%s", util.FormattedVersion(), graphqlClientVersion)
|
||||
}
|
||||
|
||||
func baseVersion(v string) string {
|
||||
|
|
@ -163,6 +161,8 @@ func NewTibberFromConfig(ctx context.Context, other map[string]interface{}) (api
|
|||
}
|
||||
}()
|
||||
|
||||
log.INFO.Printf("!! User-Agent set to %s", getUserAgent())
|
||||
|
||||
return t, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue