Documentation ¶
Index ¶
- func GRPC(log *slog.Logger, host string, port uint16, srv *grpc.Server) func(context.Context) error
- func GRPCGateWay(log *slog.Logger, host string, port uint16, cfg GateWayConfig) func(context.Context) error
- func HTTP(log *slog.Logger, host string, port uint16, handler http.Handler) func(context.Context) error
- func HandleMetrics(mux *http.ServeMux, reg *prometheus.Registry)
- func Metrics(log *slog.Logger, host string, port uint16, reg *prometheus.Registry) func(context.Context) error
- func Start(ctx context.Context, services ...func(context.Context) error) error
- type GateWayConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCGateWay ¶
func GRPCGateWay(log *slog.Logger, host string, port uint16, cfg GateWayConfig) func(context.Context) error
GRPCGateWay starts HTTP-proxy server for gRPC serer, for using gRPC endpoints from WEB.
func HTTP ¶
func HTTP(log *slog.Logger, host string, port uint16, handler http.Handler) func(context.Context) error
HTTP starts HTTP server on addr using handler logged as service. It runs until failed or ctx.Done.
func HandleMetrics ¶
func HandleMetrics(mux *http.ServeMux, reg *prometheus.Registry)
HandleMetrics adds reg's prometheus handler on /metrics at mux.
func Metrics ¶
func Metrics(log *slog.Logger, host string, port uint16, reg *prometheus.Registry) func(context.Context) error
Metrics starts HTTP server on addr path /metrics using reg as prometheus handler.
Types ¶
type GateWayConfig ¶
type GateWayConfig struct { FS embed.FS Spec string GRPCServerPort uint16 Reg *prometheus.Registry Namespace string GRPCGWPattern string // Pattern for http.ServeMux to serve grpc-gateway. DocsUIPattern string // Pattern for http.ServeMux to serve Swagger UI. Register func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error // Register gRPC server. DevMode bool }
GateWayConfig is config for building gRPC-Gateway proxy for WEB clients.
Click to show internal directories.
Click to hide internal directories.