Documentation
¶
Index ¶
- type Checker
- type Closer
- type DebugServer
- func (d *DebugServer) AddChecker(checker Checker)
- func (d *DebugServer) AddCheckers(checkers []Checker)
- func (d *DebugServer) Live(c echo.Context) error
- func (d *DebugServer) Ready(c echo.Context) error
- func (d *DebugServer) RunDebug() error
- func (d *DebugServer) SetReady(ready bool)
- func (d *DebugServer) ShutdownDebug(ctx context.Context) error
- type DefaultChecker
- type DefaultCloser
- type Server
- type ServerOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DebugServer ¶
type DebugServer struct {
PORT string `json:"port" envconfig:"PORT" default:":8084"`
// contains filtered or unexported fields
}
func NewDebugServer ¶
func NewDebugServer(port string) *DebugServer
func (*DebugServer) AddChecker ¶
func (d *DebugServer) AddChecker(checker Checker)
func (*DebugServer) AddCheckers ¶
func (d *DebugServer) AddCheckers(checkers []Checker)
AddCheckers for check your server is live
func (*DebugServer) Ready ¶
func (d *DebugServer) Ready(c echo.Context) error
Ready is probe checker
func (*DebugServer) RunDebug ¶
func (d *DebugServer) RunDebug() error
func (*DebugServer) SetReady ¶
func (d *DebugServer) SetReady(ready bool)
SetReady set server ready
warning use this method only when you sure that server is ready
func (*DebugServer) ShutdownDebug ¶
func (d *DebugServer) ShutdownDebug(ctx context.Context) error
type DefaultChecker ¶
DefaultChecker is a default implementation of Checker if you want simple checker without implementation Checker interface tou can call this function and receive Checker interface
func NewDefaultChecker ¶
func NewDefaultChecker(name string, checkFunc func() error) *DefaultChecker
func (*DefaultChecker) Check ¶
func (c *DefaultChecker) Check() error
func (*DefaultChecker) Name ¶
func (c *DefaultChecker) Name() string
type DefaultCloser ¶
type DefaultCloser struct {
Name string `json:"name"`
CloseFunc func(ctx context.Context, wg *sync.WaitGroup) error `json:"close"`
}
DefaultCloser is a default implementation of Closer if you want simple checker without implementation Closer interface tou can call this function and receive Closer interface
func (*DefaultCloser) GetName ¶
func (d *DefaultCloser) GetName() string
type Server ¶
type Server struct {
*DebugServer
// contains filtered or unexported fields
}
Server is app engine with debug server
Use AddCloser to add closer objects for shutdown your application gracefully(for more information see AddCloser)
Use AddActor to add actor control you background task(for more information see AddActor)
Use AddChecker to add checker for live probe(for more information see AddChecker)
You can change config engine use ENV variables DEBUG_PORT and SHUTDOWN_TIMEOUT(for example 30s)
func NewServer ¶
NewServer create new server
You can change config engine use ENV variables DEBUG_PORT and SHUTDOWN_TIMEOUT(for example 30s) or use With function
func (*Server) AddActor ¶
AddActor add actor control you background task you have execute function and done function(interrupt function) interrupt function handle the error execute function is called when server is ready
func (*Server) AddCloser ¶
AddCloser add closer object for shutdown your application gracefully you need to handle the context and call wg.Done() when done
func (*Server) AddClosers ¶
type ServerOpt ¶
type ServerOpt func(*Server)
func WithDebugPort ¶
WithDebugPort set debug port use value with `:` for example: :8084
func WithDisableBanner ¶
func WithDisableBanner() ServerOpt
WithDisableBanner disable witcher Banner
func WithShutdownTimeout ¶
WithShutdownTimeout set shutdown timeout
timeout is duration for graceful shutdown