svc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigInvalid = `Invalid or missing config`

ErrConfigInvalid is returned when the config parse is invalid.

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

Option defines a single option function.

func AppFS

func AppFS(val fs.FS) Option

AppFS provides a function to set the appFS option.

func AppsHTTPEndpoint

func AppsHTTPEndpoint(val string) Option

AppsHTTPEndpoint provides a function to set the appsHTTPEndpoint option.

func Config

func Config(val *config.Config) Option

Config provides a function to set the config option.

func CoreFS

func CoreFS(val fs.FS) Option

CoreFS provides a function to set the coreFS option.

func GatewaySelector

func GatewaySelector(gatewaySelector pool.Selectable[gateway.GatewayAPIClient]) Option

GatewaySelector provides a function to set the gatewaySelector option.

func Logger

func Logger(val log.Logger) Option

Logger provides a function to set the logger option.

func Middleware

func Middleware(val ...func(http.Handler) http.Handler) Option

Middleware provides a function to set the middleware option.

func ThemeFS

func ThemeFS(val *fsx.FallbackFS) Option

ThemeFS provides a function to set the themeFS option.

func TraceProvider

func TraceProvider(val trace.TracerProvider) Option

TraceProvider provides a function to set the traceProvider option.

type Options

type Options struct {
	Logger           log.Logger
	Config           *config.Config
	Middleware       []func(http.Handler) http.Handler
	GatewaySelector  pool.Selectable[gateway.GatewayAPIClient]
	TraceProvider    trace.TracerProvider
	AppsHTTPEndpoint string
	CoreFS           fs.FS
	AppFS            fs.FS
	ThemeFS          *fsx.FallbackFS
}

Options define the available options for this package.

type Service

type Service interface {
	ServeHTTP(w http.ResponseWriter, r *http.Request)
	Config(w http.ResponseWriter, r *http.Request)
}

Service defines the service handlers.

func NewInstrument

func NewInstrument(next Service, metrics *metrics.Metrics) Service

NewInstrument returns a service that instruments metrics.

func NewLogging

func NewLogging(next Service, logger log.Logger) Service

NewLogging returns a service that logs messages.

func NewService

func NewService(opts ...Option) (Service, error)

NewService returns a service implementation for Service.

type Web

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

Web defines the handlers for the web service.

func (Web) Config

func (p Web) Config(w http.ResponseWriter, _ *http.Request)

Config implements the Service interface.

func (Web) ServeHTTP

func (p Web) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the Service interface.

func (Web) Static

func (p Web) Static(f fs.FS, root string, ttl int) http.HandlerFunc

Static simply serves all static files.

Jump to

Keyboard shortcuts

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