app

package
v1.4.23 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MountDebug added in v1.3.3

func MountDebug(mux *http.ServeMux)

MountDebug will mount pprof routes on the passed in mux.

func MountEndpoint

func MountEndpoint(mux *http.ServeMux, endpoint string, handler http.Handler)

MountEndpoint mounts an endpoint on the mux and logs out the action.

func Serve

func Serve(opts *ServerOpts) error

Serve creates and starts a new server to provide image resizing services.

func Tracer added in v1.3.0

func Tracer(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

Tracer adds opentracing spanning to each incoming request.

Types

type ServerOpts

type ServerOpts struct {
	// Addr is the address to listen for http requests on.
	Addr string

	// Debug enables pprof endpoints and debug logs.
	Debug bool

	// DisableMetrics disables Prometheus endpoints.
	DisableMetrics bool

	// Backends is the comma separated <host>,<origin> where <origin> is a pathname
	// or a url (with scheme) to load images from.
	Backends []string

	// OriginCache is the reference to the cache source for origin based
	// backends.
	OriginCache string

	// CacheTimeout is the time that images will have cache headers for when
	// writing them out to the http response.
	CacheTimeout time.Duration

	// CORSDomains are the permitted domains that will be permitted to make
	// CORS requests from.
	CORSDomains []string

	// SigningSecret is used to mount a signing middleware on the image
	// processing domain to only allow signed requests through.
	SigningSecret string

	// IncludePath when true will add the path component to the signing value
	// when request signing has been enabled.
	IncludePath bool
}

ServerOpts is the options for starting a new Server.

Jump to

Keyboard shortcuts

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