server

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server contains the logic of the Service Manager server and a mux router

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*mux.Router

	Config *Settings
}

Server is the server to process incoming HTTP requests

func New

func New(config *Settings, api *web.API) *Server

New creates a new server with the provided REST api configuration and server configuration Returns the new server and an error if creation was not successful

func (*Server) Run

func (s *Server) Run(ctx context.Context)

Run starts the server awaiting for incoming requests

type Settings

type Settings struct {
	Host            string        `mapstructure:"host"`
	Port            int           `mapstructure:"port"`
	RequestTimeout  time.Duration `mapstructure:"request_timeout"`
	ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout"`
	MaxBodyBytes    int           `mapstructure:"max_body_bytes"`
	MaxHeaderBytes  int           `mapstructure:"max_header_bytes"`
}

Settings type to be loaded from the environment

func DefaultSettings

func DefaultSettings() *Settings

DefaultSettings returns the default values for configuring the Service Manager

func NewSettings

func NewSettings(env env.Environment) (*Settings, error)

NewSettings returns Server settings for the given enrivonment

func (*Settings) Validate

func (s *Settings) Validate() error

Validate validates the server settings

Jump to

Keyboard shortcuts

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