Documentation
¶
Index ¶
- type Handler
- func (*Handler) CaddyModule() caddy.ModuleInfo
- func (h *Handler) Cleanup() error
- func (h *Handler) Provision(ctx caddy.Context) error
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (h *Handler) Validate() error
- type SlogWrapper
- type ZapSlogHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// Configuration
NatsURL string `json:"nats_url,omitempty"`
NKeySeedFile string `json:"nkey_seed_file,omitempty"` // Optional NKey seed
RequestTimeout caddy.Duration `json:"request_timeout,omitempty"`
Service string `json:"service,omitempty"` // Target NATS service name
// contains filtered or unexported fields
}
Handler implements the Caddy HTTP handler for narun integration using NATS Micro.
func (*Handler) CaddyModule ¶
func (*Handler) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Handler) Provision ¶
Provision sets up the handler instance. Connects to NATS, validates config.
func (*Handler) UnmarshalCaddyfile ¶
UnmarshalCaddyfile sets up the handler from Caddyfile tokens.
type SlogWrapper ¶
type SlogWrapper struct {
// contains filtered or unexported fields
}
func NewSlogWrapper ¶
func NewSlogWrapper(zapLogger *zap.Logger) *SlogWrapper
NewSlogWrapper creates a slog-compatible wrapper around a zap logger.
func (*SlogWrapper) Debug ¶
func (s *SlogWrapper) Debug(msg string, args ...any)
Debug implements the slog interface.
func (*SlogWrapper) Error ¶
func (s *SlogWrapper) Error(msg string, args ...any)
Error implements the slog interface.
func (*SlogWrapper) Info ¶
func (s *SlogWrapper) Info(msg string, args ...any)
Info implements the slog interface.
func (*SlogWrapper) Warn ¶
func (s *SlogWrapper) Warn(msg string, args ...any)
Warn implements the slog interface.
type ZapSlogHandler ¶
type ZapSlogHandler struct {
// contains filtered or unexported fields
}
ZapSlogHandler implements slog.Handler by writing records to a zap.Logger.
func NewZapSlogHandler ¶
func NewZapSlogHandler(logger *zap.Logger, level slog.Leveler) *ZapSlogHandler
NewZapSlogHandler creates a handler that writes slog records using zap. It skips 2 caller frames by default (New + Handle) to show the correct source location.