GCS: add user agent

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-08-28 19:47:38 +02:00
parent 53c3905ce3
commit bb422ad5b9
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -88,7 +88,10 @@ func NewGCSFs(connectionID, localTempDir, mountPath string, config GCSFsConfig)
}
ctx := context.Background()
if fs.config.AutomaticCredentials > 0 {
fs.svc, err = storage.NewClient(ctx, storage.WithJSONReads())
fs.svc, err = storage.NewClient(ctx,
storage.WithJSONReads(),
option.WithUserAgent(version.GetVersionHash()),
)
} else {
err = fs.config.Credentials.TryDecrypt()
if err != nil {
@ -96,6 +99,7 @@ func NewGCSFs(connectionID, localTempDir, mountPath string, config GCSFsConfig)
}
fs.svc, err = storage.NewClient(ctx,
storage.WithJSONReads(),
option.WithUserAgent(version.GetVersionHash()),
option.WithCredentialsJSON([]byte(fs.config.Credentials.GetPayload())),
)
}