common

package module
v0.0.0-...-4ce310b Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoBindEnv

func AutoBindEnv(viper *viper.Viper, iface interface{})

TODO: this won't be needed after https://github.com/spf13/viper/pull/1429 adapted from https://github.com/spf13/viper/issues/188#issuecomment-399884438

func NewLogger

func NewLogger(debug bool) (*zap.Logger, error)

func NewS3

func NewS3(cfg *S3Config) (*s3.Client, error)

func ToHTTPHandler

func ToHTTPHandler(handle httprouter.Handle) http.Handler

func ToHTTPRouterHandle

func ToHTTPRouterHandle(h Handler, l *zap.Logger) httprouter.Handle

Types

type AgentFilterHandler

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

func (AgentFilterHandler) Handle

func (h AgentFilterHandler) Handle(i Input) (int, error)

type Handler

type Handler interface {
	Handle(Input) (int, error)
}

func AgentFilterMiddleware

func AgentFilterMiddleware(handler Handler, agent string) Handler

func LoggingMiddleware

func LoggingMiddleware(handler Handler) Handler

func StaticStatus

func StaticStatus(status int) Handler

func StaticStatusError

func StaticStatusError(status int, err error) Handler

func StatusMiddleware

func StatusMiddleware(handler Handler, debug bool) Handler

type Input

type Input struct {
	Request  *http.Request
	Response http.ResponseWriter
	Params   httprouter.Params
	Logger   *zap.Logger
}

type LoggingHandler

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

func (LoggingHandler) Handle

func (h LoggingHandler) Handle(i Input) (int, error)

type S3Config

type S3Config struct {
	Endpoint *string `mapstructure:"S3_ENDPOINT"`
	Key      *string `mapstructure:"S3_KEY"`
	Secret   *string `mapstructure:"S3_SECRET"`
}

Jump to

Keyboard shortcuts

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