Server initializes the debug service and server.
(opts ...Option)
| 12 | |
| 13 | // Server initializes the debug service and server. |
| 14 | func Server(opts ...Option) (*http.Server, error) { |
| 15 | options := newOptions(opts...) |
| 16 | |
| 17 | secureOption := nats.Secure( |
| 18 | options.Config.Postprocessing.Events.EnableTLS, |
| 19 | options.Config.Postprocessing.Events.TLSInsecure, |
| 20 | options.Config.Postprocessing.Events.TLSRootCACertificate, |
| 21 | ) |
| 22 | readyHandlerConfiguration := handlers.NewCheckHandlerConfiguration(). |
| 23 | WithLogger(options.Logger). |
| 24 | WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Postprocessing.Events.Endpoint, secureOption)) |
| 25 | |
| 26 | return debug.NewService( |
| 27 | debug.Logger(options.Logger), |
| 28 | debug.Name(options.Config.Service.Name), |
| 29 | debug.Version(version.GetString()), |
| 30 | debug.Address(options.Config.Debug.Addr), |
| 31 | debug.Token(options.Config.Debug.Token), |
| 32 | debug.Pprof(options.Config.Debug.Pprof), |
| 33 | debug.Zpages(options.Config.Debug.Zpages), |
| 34 | debug.Ready(handlers.NewCheckHandler(readyHandlerConfiguration)), |
| 35 | ), nil |
| 36 | } |
no test coverage detected