httpserver

package
v0.0.0-...-fa37cd3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package httpserver handles the logic of configuring an HTTP server with TLS certs, choosing a port to listen on, etc, which is orthogonal to the business logic of the actual service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(config *Config, handler http.Handler) error

Run an http server based on the config, using the handler to service requests. if the handler is nil, http.DefaultServeMux is used. If Run returns, the error will be non-nil.

Types

type Config

type Config struct {
	ListenAddr string `env:"LISTEN_ADDR,required"`
	Insecure   bool   `env:"INSECURE" envDefault:"false"`
	TLSCert    string `env:"TLS_CERT"`
	TLSKey     string `env:"TLS_KEY"`
}

Config captures the http server related configuration from the environment.

func (*Config) Validate

func (config *Config) Validate() error

Validate the config, returning an error describing any problems which occur.

Jump to

Keyboard shortcuts

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