@@ -196,30 +196,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
196
196
filesRateLimit = - 1
197
197
}
198
198
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
-
223
199
// Ensure we have a unique cache directory for this process.
224
200
cacheDir := filepath .Join (cfg .CacheDir .String (), uuid .NewString ())
225
201
err = os .MkdirAll (cacheDir , 0o700 )
@@ -228,13 +204,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
228
204
}
229
205
defer os .RemoveAll (cacheDir )
230
206
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
-
238
207
config := r .createConfig ()
239
208
240
209
builtinPostgres := false
@@ -263,28 +232,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
263
232
}()
264
233
}
265
234
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
-
288
235
//If the access URL is empty, we attempt to run a reverse-proxy
289
236
//tunnel to make the initial setup really simple.
290
237
var (
@@ -324,23 +271,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
324
271
return xerrors .Errorf ("parse access URL port: %w" , err )
325
272
}
326
273
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
-
344
274
// Used for zero-trust instance identity with Google Cloud.
345
275
googleTokenValidator , err := idtoken .NewValidator (ctx , option .WithoutAuthentication ())
346
276
if err != nil {
@@ -377,15 +307,6 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
377
307
return xerrors .Errorf ("create derp map: %w" , err )
378
308
}
379
309
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
-
389
310
gitAuthEnv , err := ReadGitAuthProvidersFromEnv (os .Environ ())
390
311
if err != nil {
391
312
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.
406
327
)
407
328
}
408
329
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
-
414
330
configSSHOptions , err := cfg .SSHConfig .ParseOptions ()
415
331
if err != nil {
416
332
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.
661
577
defer options .Telemetry .Close ()
662
578
}
663
579
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
-
692
580
if cfg .Swagger .Enable {
693
581
options .SwaggerEndpoint = cfg .Swagger .Enable .Value ()
694
582
}
0 commit comments