MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / Serve

Method Serve

rest/config.go:1465–1494  ·  view source on GitHub ↗
(ctx context.Context, config *StartupConfig, t serverType, addr string, handler http.Handler)

Source from the content-addressed store, hash-verified

1463}
1464
1465func (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
1497func (sc *StartupConfig) Validate(ctx context.Context, isEnterpriseEdition bool) (errorMessages error) {

Callers 2

ListenAndServeHTTPFunction · 0.80
StartServerFunction · 0.80

Calls 4

addHTTPServerMethod · 0.95
ListenAndServeHTTPFunction · 0.92
GetTLSVersionFromStringFunction · 0.85
ValueMethod · 0.45

Tested by

no test coverage detected