@@ -29,6 +29,7 @@ type Config struct {
29
29
SkipTLSVerify bool
30
30
LibraryRef string
31
31
Force bool
32
+ UserAgent string
32
33
}
33
34
34
35
// App represents the application instance
@@ -77,7 +78,7 @@ func New(ctx context.Context, cfg *Config) (*App, error) {
77
78
}
78
79
79
80
// Initialize build & library clients
80
- if app .buildClient , app .libraryClient , err = getClients (ctx , cfg .SkipTLSVerify , feURL , cfg .AuthToken ); err != nil {
81
+ if app .buildClient , app .libraryClient , err = getClients (ctx , cfg .SkipTLSVerify , feURL , cfg .AuthToken , cfg . UserAgent ); err != nil {
81
82
return nil , fmt .Errorf ("error initializing client(s): %w" , err )
82
83
}
83
84
return app , nil
@@ -118,7 +119,7 @@ func getFrontendURL(r *library.Ref, urlOverride string) (string, error) {
118
119
}
119
120
120
121
// getClients returns initialized clients for remote build and cloud library
121
- func getClients (ctx context.Context , skipVerify bool , endpoint , authToken string ) (* build.Client , * library.Client , error ) {
122
+ func getClients (ctx context.Context , skipVerify bool , endpoint , authToken , userAgent string ) (* build.Client , * library.Client , error ) {
122
123
feCfg , err := endpoints .GetFrontendConfig (ctx , skipVerify , endpoint )
123
124
if err != nil {
124
125
return nil , nil , err
@@ -132,6 +133,7 @@ func getClients(ctx context.Context, skipVerify bool, endpoint, authToken string
132
133
BaseURL : feCfg .BuildAPI .URI ,
133
134
AuthToken : authToken ,
134
135
HTTPClient : & http.Client {Transport : tr },
136
+ UserAgent : userAgent ,
135
137
})
136
138
if err != nil {
137
139
return nil , nil , fmt .Errorf ("error initializing build client: %w" , err )
@@ -141,6 +143,7 @@ func getClients(ctx context.Context, skipVerify bool, endpoint, authToken string
141
143
BaseURL : feCfg .LibraryAPI .URI ,
142
144
AuthToken : authToken ,
143
145
HTTPClient : & http.Client {Transport : tr },
146
+ UserAgent : userAgent ,
144
147
})
145
148
if err != nil {
146
149
return nil , nil , fmt .Errorf ("error initializing library client: %w" , err )
0 commit comments