(ctx context.Context, config *StartupConfig, t serverType, addr string, handler http.Handler)
| 1463 | } |
| 1464 | |
| 1465 | func (sc *ServerContext) Serve(ctx context.Context, config *StartupConfig, t serverType, addr string, handler http.Handler) error { |
| 1466 | http2Enabled := false |
| 1467 | if config.Unsupported.HTTP2 != nil && config.Unsupported.HTTP2.Enabled != nil { |
| 1468 | http2Enabled = *config.Unsupported.HTTP2.Enabled |
| 1469 | } |
| 1470 | |
| 1471 | tlsMinVersion := GetTLSVersionFromString(&config.API.HTTPS.TLSMinimumVersion) |
| 1472 | |
| 1473 | serveFn, listenerAddr, server, err := base.ListenAndServeHTTP( |
| 1474 | ctx, |
| 1475 | addr, |
| 1476 | config.API.MaximumConnections, |
| 1477 | config.API.HTTPS.TLSCertPath, |
| 1478 | config.API.HTTPS.TLSKeyPath, |
| 1479 | handler, |
| 1480 | config.API.ServerReadTimeout.Value(), |
| 1481 | config.API.ServerWriteTimeout.Value(), |
| 1482 | config.API.ReadHeaderTimeout.Value(), |
| 1483 | config.API.IdleTimeout.Value(), |
| 1484 | http2Enabled, |
| 1485 | tlsMinVersion, |
| 1486 | ) |
| 1487 | if err != nil { |
| 1488 | return err |
| 1489 | } |
| 1490 | |
| 1491 | sc.addHTTPServer(t, &serverInfo{server: server, addr: listenerAddr}) |
| 1492 | |
| 1493 | return serveFn() |
| 1494 | } |
| 1495 | |
| 1496 | // Validate returns errors errors if invalid config is present |
| 1497 | func (sc *StartupConfig) Validate(ctx context.Context, isEnterpriseEdition bool) (errorMessages error) { |
no test coverage detected