mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
use version.GetUserAgent
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
This commit is contained in:
parent
31588e7908
commit
faf7fc5efd
2 changed files with 4 additions and 5 deletions
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package registry // import "helm.sh/helm/v3/internal/experimental/registry"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
|
@ -30,8 +29,6 @@ import (
|
|||
"helm.sh/helm/v3/pkg/helmpath"
|
||||
)
|
||||
|
||||
var userAgent = fmt.Sprintf("helm/%s", version.GetVersion())
|
||||
|
||||
type (
|
||||
// Client works with OCI-compliant registries
|
||||
Client struct {
|
||||
|
|
@ -64,7 +61,7 @@ func NewClient(options ...ClientOption) (*Client, error) {
|
|||
}
|
||||
if client.resolver == nil {
|
||||
headers := http.Header{}
|
||||
headers.Set("User-Agent", userAgent)
|
||||
headers.Set("User-Agent", version.GetUserAgent())
|
||||
opts := []auth.ResolverOption{auth.WithResolverHeaders(headers)}
|
||||
resolver, err := client.authorizer.ResolverWithOpts(opts...)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import (
|
|||
"fmt"
|
||||
|
||||
"oras.land/oras-go/pkg/auth"
|
||||
|
||||
"helm.sh/helm/v3/internal/version"
|
||||
)
|
||||
|
||||
// Login logs into a registry
|
||||
|
|
@ -33,7 +35,7 @@ func (c *Client) Login(host string, options ...LoginOption) (*LoginResult, error
|
|||
auth.WithLoginHostname(host),
|
||||
auth.WithLoginUsername(operation.username),
|
||||
auth.WithLoginSecret(operation.password),
|
||||
auth.WithLoginUserAgent(userAgent),
|
||||
auth.WithLoginUserAgent(version.GetUserAgent()),
|
||||
}
|
||||
if operation.insecure {
|
||||
authorizerLoginOpts = append(authorizerLoginOpts, auth.WithLoginInsecure())
|
||||
|
|
|
|||
Loading…
Reference in a new issue