From c6c066b170d7350a56d881bd16b17a5bf296ace5 Mon Sep 17 00:00:00 2001 From: Geoffrey Date: Fri, 19 Sep 2025 18:02:51 +0200 Subject: [PATCH] feat: add a 'user_agent' field to the config file #1685 --- scw/config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scw/config.go b/scw/config.go index af0995df4..1fd984d27 100644 --- a/scw/config.go +++ b/scw/config.go @@ -105,6 +105,7 @@ profiles: # default_region: fr-par # api_url: https://api.scaleway.com # insecure: false +# user_agent: 'MyApp/1.0 (Custom User Agent; OS=Linux; Version=2.0)' {{ end -}} ` @@ -124,6 +125,7 @@ type Profile struct { DefaultRegion *string `yaml:"default_region,omitempty" json:"default_region,omitempty"` DefaultZone *string `yaml:"default_zone,omitempty" json:"default_zone,omitempty"` SendTelemetry *bool `yaml:"send_telemetry,omitempty" json:"send_telemetry,omitempty"` + UserAgent *string `yaml:"user_agent,omitempty" json:"user_agent,omitempty"` } func (p *Profile) String() string { @@ -229,6 +231,10 @@ func LoadConfigFromPath(path string) (*Config, error) { return nil, errors.Wrap(err, "content of config file %s is invalid", path) } + if confV2.UserAgent == nil || *confV2.UserAgent == "" { + confV2.UserAgent = &userAgent + } + return confV2, nil }