internalserver

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(logger log.Logger, cfg Config) (run func() error, stop func(error))

func NewReadinessHandler added in v1.1.1

func NewReadinessHandler(ready ReadinessProvider, logger log.Logger) func(w http.ResponseWriter, r *http.Request)

NewReadinessHandler returns an endpoint that returns a simple 200 to denote the web server is active

Types

type AlwaysReady added in v1.1.1

type AlwaysReady struct{}

func (AlwaysReady) Ready added in v1.1.1

func (AlwaysReady) Ready() bool

type Config

type Config struct {
	HTTPListenAddress             string        `yaml:"http_listen_address"`
	HTTPListenPort                int           `yaml:"http_listen_port"`
	ServerGracefulShutdownTimeout time.Duration `yaml:"graceful_shutdown_timeout"`

	ReadinessProvider ReadinessProvider `yaml:"-"`
}

Config for the Internal Server

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(flags *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, flags *flag.FlagSet)

RegisterFlagsWithPrefix registers flags, adding the provided prefix if needed. If the prefix is not blank and doesn't end with '.', a '.' is appended to it.

type ReadinessProvider added in v1.1.1

type ReadinessProvider interface {
	Ready() bool
}

Jump to

Keyboard shortcuts

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