mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-26 22:49:59 -06:00
32 lines
832 B
Go
32 lines
832 B
Go
package debug
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
|
|
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
|
|
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
|
)
|
|
|
|
// Server initializes the debug service and server.
|
|
func Server(opts ...Option) (*http.Server, error) {
|
|
options := newOptions(opts...)
|
|
|
|
checkHandler := handlers.NewCheckHandler(
|
|
handlers.NewCheckHandlerConfiguration().
|
|
WithLogger(options.Logger),
|
|
)
|
|
|
|
return debug.NewService(
|
|
debug.Logger(options.Logger),
|
|
debug.Name(options.Config.Service.Name),
|
|
debug.Version(version.GetString()),
|
|
debug.Address(options.Config.Debug.Addr),
|
|
debug.Token(options.Config.Debug.Token),
|
|
debug.Pprof(options.Config.Debug.Pprof),
|
|
debug.Zpages(options.Config.Debug.Zpages),
|
|
debug.Health(checkHandler),
|
|
debug.Ready(checkHandler),
|
|
), nil
|
|
}
|