Documentation ¶
Index ¶
- func WithAfterStart(funcs []func() error) func(*Server)
- func WithAfterStop(funcs []func() error) func(*Server)
- func WithBeforeStart(funcs []func() error) func(*Server)
- func WithBeforeStop(funcs []func() error) func(*Server)
- func WithChiAndGRPCServer(cfg chi.Config, gcfg grpc.Config) func(*Server)
- func WithChiServer(cfg chi.Config) func(*Server)
- func WithCustomGoroutines(funcs []func() error) func(*Server)
- func WithGRPCServer(cfg grpc.Config) func(*Server)
- func WithGRPCServerPort(port string) func(*Server)
- func WithGinAndGRPCServer(cfg gin.Config, gcfg grpc.Config) func(*Server)
- func WithGinServer(cfg gin.Config) func(*Server)
- func WithHTTPServerPort(port string) func(*Server)
- func WithParallelMode() func(*Server)
- func WithServerName(name string) func(*Server)
- type Env
- type Server
- func (s *Server) AddChiAndGRPCMixedServer()
- func (s *Server) AddChiServer()
- func (s *Server) AddFgprofServer()
- func (s *Server) AddGRPCServer()
- func (s *Server) AddGinAndGRPCMixedServer()
- func (s *Server) AddGinServer()
- func (s *Server) AddGracefulShutdown(ctx context.Context)
- func (s *Server) AddPrometheusServer()
- func (s *Server) Start() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAfterStart ¶
WithAfterStart executes functions after servers start.
func WithAfterStop ¶
WithAfterStop executes functions after servers stop.
func WithBeforeStart ¶
WithBeforeStart executes functions before servers start.
func WithBeforeStop ¶
WithBeforeStop executes functions before servers stop.
func WithChiAndGRPCServer ¶ added in v0.2.7
WithChiAndGRPCServer provides chi http and grpc servers and runs them after Start.
func WithChiServer ¶
WithChiServer provides chi http kit and runs it after Start.
func WithCustomGoroutines ¶
WithCustomGoroutines adds goroutines to main errgroup instance of kit.
func WithGRPCServer ¶
WithGRPCServer provides grpc kit and runs it after Start.
func WithGRPCServerPort ¶
WithGRPCServerPort sets provided port to grpc kit.
func WithGinAndGRPCServer ¶ added in v0.2.7
WithGinAndGRPCServer provides gin http and grpc servers and runs them after Start.
func WithGinServer ¶
WithGinServer provides gin http kit and runs it after Start.
func WithHTTPServerPort ¶
WithHTTPServerPort sets provided port to http kit.
func WithParallelMode ¶
func WithParallelMode() func(*Server)
WithParallelMode sets http and grpc servers to bind on one port and segregate requests by headers.
func WithServerName ¶
WithServerName sets name of service.
Types ¶
type Env ¶
type Env struct { ServerVersion string `env:"KIT_SERVER_VERSION" envDefault:"0.0.0"` GracefulShutdownTimeout time.Duration `env:"KIT_GRACEFUL_SHUTDOWN" envDefault:"5s"` OTELJaegerHost string `env:"KIT_TRACING_JAEGER_HOST" envDefault:"localhost:4318"` FgprofEnable bool `env:"KIT_METRICS_FGPROF" envDefault:"false"` PprofEnable bool `env:"KIT_METRICS_PPROF" envDefault:"false"` DebugHeaders bool `env:"KIT_DEBUG_HEADERS" envDefault:"false"` }
type Server ¶
type Server struct { // !ATTENTION! Options must be set before Start. ServerName string ServerVersion string RootCtx context.Context GinServer *gincore.Engine ChiServer *chicore.Mux GRPCServer *grpccore.Server // Loggers. DefaultLogger *zapl.Logger PromCollectors []prometheus.Collector // contains filtered or unexported fields }
Server describes all services configurations, must be executed with Start.
func New ¶
New is base constructor function to create service with options, but won't start it without Start.
func (*Server) AddChiAndGRPCMixedServer ¶ added in v0.2.7
func (s *Server) AddChiAndGRPCMixedServer()
func (*Server) AddChiServer ¶ added in v0.2.7
func (s *Server) AddChiServer()
func (*Server) AddFgprofServer ¶ added in v0.2.7
func (s *Server) AddFgprofServer()
func (*Server) AddGRPCServer ¶ added in v0.2.7
func (s *Server) AddGRPCServer()
func (*Server) AddGinAndGRPCMixedServer ¶ added in v0.2.7
func (s *Server) AddGinAndGRPCMixedServer()
func (*Server) AddGinServer ¶ added in v0.2.7
func (s *Server) AddGinServer()
func (*Server) AddGracefulShutdown ¶ added in v0.2.7
func (*Server) AddPrometheusServer ¶ added in v0.2.7
func (s *Server) AddPrometheusServer()