MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / Server

Function Server

services/sharing/pkg/server/debug/server.go:14–41  ·  view source on GitHub ↗

Server initializes the debug service and server.

(opts ...Option)

Source from the content-addressed store, hash-verified

12
13// Server initializes the debug service and server.
14func Server(opts ...Option) (*http.Server, error) {
15 options := newOptions(opts...)
16
17 secureOption := nats.Secure(
18 options.Config.Events.EnableTLS,
19 options.Config.Events.TLSInsecure,
20 options.Config.Events.TLSRootCaCertPath,
21 )
22 readyHandlerConfiguration := handlers.NewCheckHandlerConfiguration().
23 WithLogger(options.Logger).
24 WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Addr, secureOption)).
25 WithCheck("grpc reachability", checks.NewGRPCCheck(options.Config.GRPC.Addr))
26
27 return debug.NewService(
28 debug.Logger(options.Logger),
29 debug.Name(options.Config.Service.Name),
30 debug.Version(version.GetString()),
31 debug.Address(options.Config.Debug.Addr),
32 debug.Token(options.Config.Debug.Token),
33 debug.Pprof(options.Config.Debug.Pprof),
34 debug.Zpages(options.Config.Debug.Zpages),
35 debug.Ready(handlers.NewCheckHandler(readyHandlerConfiguration)),
36 //debug.CorsAllowedOrigins(options.Config.HTTP.CORS.AllowedOrigins),
37 //debug.CorsAllowedMethods(options.Config.HTTP.CORS.AllowedMethods),
38 //debug.CorsAllowedHeaders(options.Config.HTTP.CORS.AllowedHeaders),
39 //debug.CorsAllowCredentials(options.Config.HTTP.CORS.AllowCredentials),
40 ), nil
41}

Callers 1

ServerFunction · 0.92

Calls 15

SecureFunction · 0.92
NewNatsCheckFunction · 0.92
NewGRPCCheckFunction · 0.92
NewServiceFunction · 0.92
LoggerFunction · 0.92
NameFunction · 0.92
VersionFunction · 0.92
GetStringFunction · 0.92
AddressFunction · 0.92
TokenFunction · 0.92
PprofFunction · 0.92

Tested by

no test coverage detected