api

package
v0.0.0-...-814a870 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ForceStopTimeout = 5 * time.Second // nolint:gochecknoglobals

ForceStopTimeout ...

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string `json:"host" yaml:"host" mapstructure:"api.host"`
	Port int    `json:"port" yaml:"port" mapstructure:"api.port"`

	ApiRequestTimeout int  `json:"api_request_timeout" yaml:"api_request_timeout" mapstructure:"api.api_request_timeout"` // nolint:golint,stylecheck
	DevMod            bool `json:"dev_mod" yaml:"dev_mod" mapstructure:"api.dev_mod"`
	EnableCORS        bool `json:"enable_cors" yaml:"enable_cors" mapstructure:"api.enable_cors"`

	RestartOnFail bool `json:"restart_on_fail" yaml:"restart_on_fail" mapstructure:"api.restart_on_fail"`
}

Config is a parameters for `http.Server`.

func (*Config) TCPAddr

func (c *Config) TCPAddr() string

TCPAddr returns tcp address for server.

func (Config) Validate

func (c Config) Validate() error

Validate - Validate config required fields

type Server

type Server struct {
	Name      string
	Config    Config
	GetConfig func() Config
	GetRouter func(*logrus.Entry, Config) http.Handler
	// contains filtered or unexported fields
}

Server worker object

func NewServer

func NewServer(name string, config Config, rGetter func(*logrus.Entry, Config) http.Handler) Server

NewServer constructor

func (*Server) Context

func (s *Server) Context() uwe.WContext

Context return application context

func (*Server) Init

func (s *Server) Init(parentCtx context.Context) uwe.Worker

Init worker implementation

func (*Server) RestartOnFail

func (s *Server) RestartOnFail() bool

RestartOnFail property for Chief

func (*Server) Run

func (s *Server) Run(ctx uwe.WContext) uwe.ExitCode

Run api-server

Jump to

Keyboard shortcuts

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