chore: refactor cli and coderd to use ClientOptions (#19763)

Refactors CLI and coderd to use the ClientBuilder pattern rather than directly instantiating the Client.
This commit is contained in:
Spike Curtis
2025-09-22 21:02:56 +04:00
committed by GitHub
parent e7d648fb28
commit a30c30724b
5 changed files with 12 additions and 14 deletions
+7 -5
View File
@@ -1004,9 +1004,10 @@ func (r *RootCmd) scaletestWorkspaceTraffic() *serpent.Command {
return xerrors.Errorf("parse workspace proxy URL: %w", err)
}
webClient = codersdk.New(u)
webClient.HTTPClient = client.HTTPClient
webClient.SetSessionToken(client.SessionToken())
webClient = codersdk.New(u,
codersdk.WithHTTPClient(client.HTTPClient),
codersdk.WithSessionToken(client.SessionToken()),
)
appConfig, err = createWorkspaceAppConfig(webClient, appHost.Host, app, ws, agent)
if err != nil {
@@ -1240,8 +1241,9 @@ func (r *RootCmd) scaletestDashboard() *serpent.Command {
return xerrors.Errorf("create token for user: %w", err)
}
userClient := codersdk.New(client.URL)
userClient.SetSessionToken(userTokResp.Key)
userClient := codersdk.New(client.URL,
codersdk.WithSessionToken(userTokResp.Key),
)
config := dashboard.Config{
Interval: interval,