cmd/uplink: use configured user agent

This change fixes an issue where the configured user agent wasn't used
by Uplink commands.

Resolves storj/customer-issues#999

Change-Id: I2d9f38308eddad7c471a100c968082783c05a3b3
This commit is contained in:
Jeremy Wharton 2023-09-14 11:42:57 -05:00 committed by Storj Robot
parent f42548ac1c
commit 012e1fbc06

View File

@ -43,6 +43,16 @@ func (ex *external) OpenProject(ctx context.Context, accessName string, options
UserAgent: uplinkCLIUserAgent,
}
userAgents, err := ex.Dynamic("client.user-agent")
if err != nil {
return nil, err
}
if len(userAgents) > 0 {
if ua := userAgents[len(userAgents)-1]; ua != "" {
config.UserAgent = ua
}
}
if opts.ConnectionPoolOptions != (rpcpool.Options{}) {
if err := transport.SetConnectionPool(ctx, &config, rpcpool.New(opts.ConnectionPoolOptions)); err != nil {
return nil, err