Documentation ¶
Index ¶
- func Run(options ...Option)
- type Option
- func WithBaseRoute(b string) Option
- func WithCertFile(f string) Option
- func WithCorsAllowedHeaders(headers []string) Option
- func WithCorsAllowedOrigins(origins []string) Option
- func WithHost(host string) Option
- func WithKeyFile(f string) Option
- func WithPort(port int) Option
- func WithStorageOptions(opts ...storage.Option) Option
- func WithTLS(b bool) Option
- func WithThrottle(t int) Option
- func WithThrottleBacklog(t int) Option
- func WithTimeout(d time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(options ...Option)
Run takes an arbitrary number of options and runs a server. The important steps here are that it configured a storage interface and wires that into a router to be used by the server handler. The runtime also leverages the Shutdown method to attempt a graceful shutdown in the event of an Interrupt signal. The shutdown process attempts to wait for all connections to close but is limited by the server timeout configuration which is passed into the context for the shutdown.
Types ¶
type Option ¶
type Option func(*options)
Option is func signature used for setting Server Options
func WithBaseRoute ¶
WithBaseRoute takes a string and returns an Option func for setting options.baseRoute
func WithCertFile ¶
WithCertFile takes a string and returns an Option func for setting options.certFile
func WithCorsAllowedHeaders ¶
WithCorsAllowedHeaders takes cors pointer and returns an Option func for setting cors
func WithCorsAllowedOrigins ¶
WithCorsAllowedOrigins takes cors pointer and returns an Option func for setting cors
func WithKeyFile ¶
WithKeyFile takes a string and returns an Option func for setting options.keyFile
func WithStorageOptions ¶
WithStorageOptions takes a set of storage options and returns an Option func for setting options.storage
func WithThrottle ¶
WithThrottle takes an int and returns an Option func for setting options.limit
func WithThrottleBacklog ¶
WithThrottleBacklog takes an int and returns an Option func for setting options.backlog
func WithTimeout ¶
WithTimeout takes a string and returns an Option func for setting options.timeout