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 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 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
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 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 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.