http_module

package
v0.0.0-...-53c1a21 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = wrappedCfg{
	Http: Config{
		ListenAddr:    "0.0.0.0",
		ListenPort:    3000,
		LogAllRequest: true,
		CORS: CorsSetting{
			AllowOrigins: []string{"*"},
			AllowHeaders: []string{"Accept", "Content-Type", "Content-Length", "Accept-Encoding", "Authorization", "ResponseType"},
		},
		H2c: false,
	},
}

Functions

func CheckConfig

func CheckConfig(cfg Config) error

func Module

func Module(force bool) fx.Option

func NewEcho

func NewEcho(
	logger *zap.Logger,
	lc fx.Lifecycle,
	cfg Config,
	serviceParams svc_module.OptionalConfig,
	ocfg optionalParams,
) *echo.Echo

Types

type Config

type Config struct {
	ListenAddr     string      `mapstructure:"listen-addr" validate:"required,ip"`
	ListenPort     int         `mapstructure:"listen-port" validate:"required,gt=0,lte=65535"`
	LogAllRequest  bool        `mapstructure:"log-all-request"`
	LogIgnorePaths []string    `mapstructure:"log-ignore-paths"`
	CORS           CorsSetting `mapstructure:"cors"`
	H2c            bool        `mapstructure:"h2c"`
}

func ReadConfig

func ReadConfig(v *viper.Viper) (Config, error)

type CorsSetting

type CorsSetting struct {
	AllowOrigins []string `mapstructure:"allowed-origins"`
	AllowHeaders []string `mapstructure:"allowed-header"`
}

type HttpOptions

type HttpOptions struct {
	fx.Out

	Before []beforeHttp `group:"before_http,flatten"`
}

func BeforeHttp

func BeforeHttp() HttpOptions

Jump to

Keyboard shortcuts

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