http

package
v2.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "http"

Variables

This section is empty.

Functions

func AfterServe

func AfterServe(cfg *LogReqConfig, log *slog.Logger) wool.AfterServe

func ErrorTransform

func ErrorTransform(err error) *wool.Error

Types

type Config

type Config struct {
	UI         *UIConfig         `mapstructure:"ui"`
	LogReq     *LogReqConfig     `mapstructure:"log_request"`
	Middleware *MiddlewareConfig `mapstructure:"middleware"`
	Swagger    *SwaggerConfig    `mapstructure:"swagger"`
	JWT        *jwt.Config       `mapstructure:"jwt"`
	SSE        *sse.Config       `mapstructure:"-"`
}

type LogReqConfig

type LogReqConfig struct {
	ExcludeRegexStatus   string `mapstructure:"exclude_status"`
	ExcludeRegexMethod   string `mapstructure:"exclude_method"`
	ExcludeRegexEndpoint string `mapstructure:"exclude_endpoint"`
	// contains filtered or unexported fields
}

type MiddlewareConfig

type MiddlewareConfig struct {
	Compress *gzip.Config       `mapstructure:"compress"`
	CORS     *cors.Config       `mapstructure:"cors"`
	Metrics  *prometheus.Config `mapstructure:"metrics"`
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Init

func (p *Plugin) Init(cfg config.Configurer, rdbMaker common.RedisMaker, sub common.Sub, uow common.UnitOfWork, log logger.Logger) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Serve

func (p *Plugin) Serve() chan error

func (*Plugin) Stop

func (p *Plugin) Stop(ctx context.Context) error

type SwaggerConfig

type SwaggerConfig struct {
	Enabled bool            `mapstructure:"enabled"`
	Front   *swagger.Config `mapstructure:"front"`
	Sys     *swagger.Config `mapstructure:"sys"`
}

type UIConfig

type UIConfig struct {
	FrontPath string `mapstructure:"front"`
	SysPath   string `mapstructure:"sys"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL