Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HealthzPort int = 0 // expose var to be able to operator HealthzPath string = "" // expose var to be able to operator DefaultFuncHealthz HealthzFunc = func() (bool, error) { _, err := net.DialTimeout("tcp", models.HealthzDefaultAddr, timeoutR) if err != nil { return false, err } return true, nil } )
Functions ¶
func Init ¶
func Init(ctx context.Context, opts ...OptionServer) (InterfaceServer, CancelFunc)
Function to initialize application, return app struct and a func waitgroup. The app contains a map of server. By default, the app contains a healthz and metrics server.
Types ¶
type CancelFunc ¶
type CancelFunc func()
type HealthzFunc ¶
Function to check the health of the application
type InterfaceServer ¶
type InterfaceServer interface { // Start all server listed in the app struct Run() (err error) // Add a new server to the app without endpoint. // return a server where you can add endpoint GET, POST, PUT, DELETE... Add(name string, opts ...Option) (s *server, err error) }
InterfaceSerever is an interface to manage the server Run: Start the server Add: Add a new server
type Option ¶
type Option func(s *server)
OptionsHTTP is a function to set the http server
type OptionServer ¶
type OptionServer func(a *app)
OptionsServer is a function to disable some server
func WithCustomHandlerForHealth ¶
func WithCustomHandlerForHealth(req HealthzFunc) OptionServer
Function WithCustomHandlerForHealth return a function Option Function take in parameter a function that return a boolean and an error and the endpoint path (e.g. /healthz)
Click to show internal directories.
Click to hide internal directories.