app

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 15 Imported by: 0

README

app

import "github.com/wyattjoh/ims/cmd/ims/app"

Overview

Index

Package files

server.go

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.

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

    // Directories is the folder in which images are served out of.
    Directories string

    // Backends is the comma seperated <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 []string
}

ServerOpts is the options for starting a new Server,


Generated by godoc2md

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)

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

	// Directories is the folder in which images are served out of.
	Directories string

	// 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