mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: cleanup unused Client in server command (#19762)
As part of converting production code to use the new ClientBuilder, I noticed some dead code that creates a client with a URL for the only purpose of later accessing the URL. This PR removes the cruft.
This commit is contained in:
+1
-14
@@ -974,23 +974,10 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
||||
}
|
||||
}
|
||||
|
||||
client := codersdk.New(localURL)
|
||||
if localURL.Scheme == "https" && IsLocalhost(localURL.Hostname()) {
|
||||
// The certificate will likely be self-signed or for a different
|
||||
// hostname, so we need to skip verification.
|
||||
client.HTTPClient.Transport = &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
//nolint:gosec
|
||||
InsecureSkipVerify: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
defer client.HTTPClient.CloseIdleConnections()
|
||||
|
||||
// This is helpful for tests, but can be silently ignored.
|
||||
// Coder may be ran as users that don't have permission to write in the homedir,
|
||||
// such as via the systemd service.
|
||||
err = config.URL().Write(client.URL.String())
|
||||
err = config.URL().Write(localURL.String())
|
||||
if err != nil && flag.Lookup("test.v") != nil {
|
||||
return xerrors.Errorf("write config url: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user