server

package
v0.0.0-...-de4b3c1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLog = "debug"
)
View Source
const (
	ErrorServerInternal = "server.internal.error"
)

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(logger *zerolog.Logger) func(next http.Handler) http.Handler

func ReadConfigAndPrepare

func ReadConfigAndPrepare(configDir string, c interface{}) error

func ReverseProxy

func ReverseProxy(r *http.Request, w http.ResponseWriter, urlTarget string)

func SendError

func SendError(w http.ResponseWriter, err error, statusCode int,
	code, message string)

Types

type APIServer

type APIServer struct {
	Listen      string `yaml:"listen"`
	TLSCert     string `yaml:"tlscert"`
	TLSKey      string `yaml:"tlskey"`
	Assets      string `yaml:"assets"`
	Backend     string `yaml:"backend"`
	BackendV2   string `yaml:"backendv2"`
	BackendSkip bool   `yaml:"skipverify"`
}

type Config

type Config struct {
	Log    Log       `yaml:"log"`
	Server APIServer `yaml:"server"`
}

type ErrResponse

type ErrResponse struct {
	Message string `json:"message"`        // user-level status message
	Code    string `json:"code,omitempty"` // error code
	Error   string `json:"error"`          // technical error string
}

type Log

type Log struct {
	API  string `yaml:"api"`
	JSON bool   `yaml:"json"`
}

type RouteManager

type RouteManager interface {
	AddExtraRoutes(r *chi.Mux) error
}

type RouteManagerAPI

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

func NewRouteManagerAPI

func NewRouteManagerAPI(config *Config) (*RouteManagerAPI, error)

func (*RouteManagerAPI) AddExtraRoutes

func (rm *RouteManagerAPI) AddExtraRoutes(r *chi.Mux) error

type Server

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

func NewServer

func NewServer(conf *Config, rm RouteManager) *Server

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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