Documentation ¶
Index ¶
- Constants
- Variables
- type Closer
- type CloserWithContext
- type ErrorCloser
- type ErrorCloserWithContext
- type ErrorShutdowner
- type ErrorShutdownerWithContext
- type ErrorUnsubscriber
- type ErrorUnsubscriberWithContext
- type Option
- func WithConfig(c *viper.Viper) Option
- func WithContext(ctx context.Context) Option
- func WithHTTPPrometheusService(enabled bool) Option
- func WithHTTPViperService(enabled bool) Option
- func WithHTTPZapService(enabled bool) Option
- func WithLogFields(fields ...zap.Field) Option
- func WithLogger(l *zap.Logger) Option
- func WithShutdownTimeout(shutdownTimeout time.Duration) Option
- type Server
- func (s *Server) AddCloser(closer interface{})
- func (s *Server) AddClosers(closers ...interface{})
- func (s *Server) AddService(service Service)
- func (s *Server) AddServices(services ...Service)
- func (s *Server) Config() *viper.Viper
- func (s *Server) Context() context.Context
- func (s *Server) Logger() *zap.Logger
- func (s *Server) Run()
- type Service
- type ServiceHTTP
- func NewDefaultServiceHTTPPrometheus() *ServiceHTTP
- func NewDefaultServiceHTTPViper() *ServiceHTTP
- func NewDefaultServiceHTTPZap() *ServiceHTTP
- func NewServiceHTTP(l *zap.Logger, name, addr string, handler http.Handler, ...) *ServiceHTTP
- func NewServiceHTTPPrometheus(l *zap.Logger, name, addr, path string) *ServiceHTTP
- func NewServiceHTTPViper(l *zap.Logger, c *viper.Viper, name, addr, path string) *ServiceHTTP
- func NewServiceHTTPZap(l *zap.Logger, name, addr, path string) *ServiceHTTP
- type Shutdowner
- type ShutdownerWithContext
- type Unsubscriber
- type UnsubscriberWithContext
Constants ¶
const ( DefaultServiceHTTPPrometheusName = "prometheus" DefaultServiceHTTPPrometheusAddr = ":9200" DefaultServiceHTTPPrometheusPath = "/metrics" )
const ( DefaultServiceHTTPViperName = "viper" DefaultServiceHTTPViperAddr = "localhost:9300" DefaultServiceHTTPViperPath = "/config" )
const ( DefaultServiceHTTPZapName = "zap" DefaultServiceHTTPZapAddr = "localhost:9100" DefaultServiceHTTPZapPath = "/log" )
Variables ¶
var ( // Version usage -ldflags "-X github.com/foomo/keel/server.Version=$VERSION" Version string // GitCommit usage -ldflags "-X github.com/foomo/keel/server.GitCommit=$GIT_COMMIT" GitCommit string // BuildTime usage -ldflags "-X 'github.com/foomo/keel/server.BuildTime=$(date -u '+%Y-%m-%d %H:%M:%S')'" BuildTime string )
Functions ¶
This section is empty.
Types ¶
type CloserWithContext ¶
CloserWithContext interface
type ErrorCloser ¶ added in v0.2.10
type ErrorCloser interface {
Close() error
}
ErrorCloser interface
type ErrorCloserWithContext ¶ added in v0.2.10
ErrorCloserWithContext interface
type ErrorShutdowner ¶ added in v0.2.10
type ErrorShutdowner interface {
Shutdown() error
}
ErrorShutdowner interface
type ErrorShutdownerWithContext ¶ added in v0.2.10
ErrorShutdownerWithContext interface
type ErrorUnsubscriber ¶ added in v0.2.10
type ErrorUnsubscriber interface {
Unsubscribe() error
}
ErrorUnsubscriber interface
type ErrorUnsubscriberWithContext ¶ added in v0.2.10
ErrorUnsubscriberWithContext interface
type Option ¶
type Option func(inst *Server)
Option func
func WithHTTPPrometheusService ¶ added in v0.2.0
WithHTTPPrometheusService option with default value
func WithHTTPViperService ¶ added in v0.2.0
WithHTTPViperService option with default value
func WithHTTPZapService ¶ added in v0.2.0
WithHTTPZapService option with default value
func WithShutdownTimeout ¶
WithShutdownTimeout option
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct
func (*Server) AddCloser ¶
func (s *Server) AddCloser(closer interface{})
AddCloser adds a closer to be called on shutdown
func (*Server) AddClosers ¶
func (s *Server) AddClosers(closers ...interface{})
AddClosers adds an closer to be called on shutdown
func (*Server) AddService ¶
AddService add a single service
func (*Server) AddServices ¶
AddServices adds multiple service
type Service ¶
type Service interface { Name() string Start(ctx context.Context) error Close(ctx context.Context) error }
Service interface
type ServiceHTTP ¶
type ServiceHTTP struct {
// contains filtered or unexported fields
}
ServiceHTTP struct
func NewDefaultServiceHTTPPrometheus ¶
func NewDefaultServiceHTTPPrometheus() *ServiceHTTP
func NewDefaultServiceHTTPViper ¶
func NewDefaultServiceHTTPViper() *ServiceHTTP
func NewDefaultServiceHTTPZap ¶
func NewDefaultServiceHTTPZap() *ServiceHTTP
func NewServiceHTTP ¶
func NewServiceHTTP(l *zap.Logger, name, addr string, handler http.Handler, middlewares ...middleware.Middleware) *ServiceHTTP
func NewServiceHTTPPrometheus ¶
func NewServiceHTTPPrometheus(l *zap.Logger, name, addr, path string) *ServiceHTTP
func NewServiceHTTPViper ¶
func NewServiceHTTPZap ¶
func NewServiceHTTPZap(l *zap.Logger, name, addr, path string) *ServiceHTTP
func (*ServiceHTTP) Name ¶ added in v0.3.3
func (s *ServiceHTTP) Name() string
type ShutdownerWithContext ¶
ShutdownerWithContext interface
type Unsubscriber ¶ added in v0.2.0
type Unsubscriber interface {
Unsubscribe()
}
Unsubscriber interface
type UnsubscriberWithContext ¶ added in v0.2.0
UnsubscriberWithContext interface