Skip to content

Commit a2c6d28

Browse files
committed
Remove commented out code
1 parent c077c72 commit a2c6d28

File tree

1 file changed

+0
-112
lines changed

1 file changed

+0
-112
lines changed

cli/server.go

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -196,30 +196,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
196196
filesRateLimit = -1
197197
}
198198

199-
//printLogo(inv)
200-
//logger, logCloser, err := BuildLogger(inv, cfg)
201-
//if err != nil {
202-
// return xerrors.Errorf("make logger: %w", err)
203-
//}
204-
//defer logCloser()
205-
206-
// This line is helpful in tests.
207-
//logger.Debug(ctx, "started debug logging")
208-
//logger.Sync()
209-
210-
// Register signals early on so that graceful shutdown can't
211-
// be interrupted by additional signals. Note that we avoid
212-
// shadowing cancel() (from above) here because notifyStop()
213-
// restores default behavior for the signals. This protects
214-
// the shutdown sequence from abruptly terminating things
215-
// like: database migrations, provisioner work, workspace
216-
// cleanup in dev-mode, etc.
217-
//
218-
// To get out of a graceful shutdown, the user can send
219-
// SIGQUIT with ctrl+\ or SIGKILL with `kill -9`.
220-
//notifyCtx, notifyStop := signal.NotifyContext(ctx, InterruptSignals...)
221-
//defer notifyStop()
222-
223199
// Ensure we have a unique cache directory for this process.
224200
cacheDir := filepath.Join(cfg.CacheDir.String(), uuid.NewString())
225201
err = os.MkdirAll(cacheDir, 0o700)
@@ -228,13 +204,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
228204
}
229205
defer os.RemoveAll(cacheDir)
230206

231-
// Clean up idle connections at the end, e.g.
232-
// embedded-postgres can leave an idle connection
233-
// which is caught by goleaks.
234-
//defer http.DefaultClient.CloseIdleConnections()
235-
236-
//tracerProvider, sqlDriver := ConfigureTraceProvider(ctx, logger, inv, cfg)
237-
238207
config := r.createConfig()
239208

240209
builtinPostgres := false
@@ -263,28 +232,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
263232
}()
264233
}
265234

266-
//httpServers, err := ConfigureHTTPServers(inv, cfg)
267-
//if err != nil {
268-
// return xerrors.Errorf("configure http(s): %w", err)
269-
//}
270-
//defer httpServers.Close()
271-
272-
// Prefer HTTP because it's less prone to TLS errors over localhost.
273-
//localURL := httpServers.TLSUrl
274-
//if httpServers.HTTPUrl != nil {
275-
// localURL = httpServers.HTTPUrl
276-
//}
277-
278-
//ctx, httpClient, err := configureHTTPClient(
279-
// ctx,
280-
// cfg.TLS.ClientCertFile.String(),
281-
// cfg.TLS.ClientKeyFile.String(),
282-
// cfg.TLS.ClientCAFile.String(),
283-
//)
284-
//if err != nil {
285-
// return xerrors.Errorf("configure http client: %w", err)
286-
//}
287-
288235
//If the access URL is empty, we attempt to run a reverse-proxy
289236
//tunnel to make the initial setup really simple.
290237
var (
@@ -324,23 +271,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
324271
return xerrors.Errorf("parse access URL port: %w", err)
325272
}
326273

327-
// Warn the user if the access URL appears to be a loopback address.
328-
//isLocal, err := isLocalURL(ctx, cfg.AccessURL.Value())
329-
//if isLocal || err != nil {
330-
// reason := "could not be resolved"
331-
// if isLocal {
332-
// reason = "isn't externally reachable"
333-
// }
334-
// cliui.Warnf(
335-
// inv.Stderr,
336-
// "The access URL %s %s, this may cause unexpected problems when creating workspaces. Generate a unique *.try.coder.app URL by not specifying an access URL.\n",
337-
// cliui.Styles.Field.Render(cfg.AccessURL.String()), reason,
338-
// )
339-
//}
340-
//
341-
//// A newline is added before for visibility in terminal output.
342-
//cliui.Infof(inv.Stdout, "\nView the Web UI: %s", cfg.AccessURL.String())
343-
344274
// Used for zero-trust instance identity with Google Cloud.
345275
googleTokenValidator, err := idtoken.NewValidator(ctx, option.WithoutAuthentication())
346276
if err != nil {
@@ -377,15 +307,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
377307
return xerrors.Errorf("create derp map: %w", err)
378308
}
379309

380-
//appHostname := cfg.WildcardAccessURL.String()
381-
//var appHostnameRegex *regexp.Regexp
382-
//if appHostname != "" {
383-
// appHostnameRegex, err = httpapi.CompileHostnamePattern(appHostname)
384-
// if err != nil {
385-
// return xerrors.Errorf("parse wildcard access URL %q: %w", appHostname, err)
386-
// }
387-
//}
388-
389310
gitAuthEnv, err := ReadGitAuthProvidersFromEnv(os.Environ())
390311
if err != nil {
391312
return xerrors.Errorf("read git auth providers from env: %w", err)
@@ -406,11 +327,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
406327
)
407328
}
408329

409-
//realIPConfig, err := httpmw.ParseRealIPConfig(cfg.ProxyTrustedHeaders, cfg.ProxyTrustedOrigins)
410-
//if err != nil {
411-
// return xerrors.Errorf("parse real ip config: %w", err)
412-
//}
413-
414330
configSSHOptions, err := cfg.SSHConfig.ParseOptions()
415331
if err != nil {
416332
return xerrors.Errorf("parse ssh config options %q: %w", cfg.SSHConfig.SSHConfigOptions.String(), err)
@@ -661,34 +577,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
661577
defer options.Telemetry.Close()
662578
}
663579

664-
//// This prevents the pprof import from being accidentally deleted.
665-
//_ = pprof.Handler
666-
//if cfg.Pprof.Enable {
667-
// //nolint:revive
668-
// defer serveHandler(ctx, logger, nil, cfg.Pprof.Address.String(), "pprof")()
669-
//}
670-
//if cfg.Prometheus.Enable {
671-
// options.PrometheusRegistry.MustRegister(collectors.NewGoCollector())
672-
// options.PrometheusRegistry.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
673-
//
674-
// closeUsersFunc, err := prometheusmetrics.ActiveUsers(ctx, options.PrometheusRegistry, options.Database, 0)
675-
// if err != nil {
676-
// return xerrors.Errorf("register active users prometheus metric: %w", err)
677-
// }
678-
// defer closeUsersFunc()
679-
//
680-
// closeWorkspacesFunc, err := prometheusmetrics.Workspaces(ctx, options.PrometheusRegistry, options.Database, 0)
681-
// if err != nil {
682-
// return xerrors.Errorf("register workspaces prometheus metric: %w", err)
683-
// }
684-
// defer closeWorkspacesFunc()
685-
//
686-
// //nolint:revive
687-
// defer serveHandler(ctx, logger, promhttp.InstrumentMetricHandler(
688-
// options.PrometheusRegistry, promhttp.HandlerFor(options.PrometheusRegistry, promhttp.HandlerOpts{}),
689-
// ), cfg.Prometheus.Address.String(), "prometheus")()
690-
//}
691-
692580
if cfg.Swagger.Enable {
693581
options.SwaggerEndpoint = cfg.Swagger.Enable.Value()
694582
}

0 commit comments

Comments
 (0)