Documentation ¶
Index ¶
Constants ¶
View Source
const ( InterfaceFieldName = "server.http.interface" PortFieldName = "server.http.port" ShutdownTimeoutFieldName = "server.http.timeout.shutdown" InterfaceDefault = "0.0.0.0" PortDefault = uint16(8080) ShutdownTimeoutDefault = 30 * time.Second )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, re_configuration.Component, router.Component, }, Constructor: func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Interface, InterfaceFieldName, InterfaceDefault, "interface for listening to incoming requests") flagSet.Uint16Var(&config.Port, PortFieldName, PortDefault, "port for listening to incoming requests") flagSet.DurationVar( &config.ShutdownTimeout, ShutdownTimeoutFieldName, ShutdownTimeoutDefault, "timeout during which the HTTP server must be turned off after receiving a shutdown signal", ) }) }, Serve: func(c container.Container) error { server, err := container.Get[*ReConfiguration](c) if err != nil { return err } closer, err := container.Get[closer.Closer](c) if err != nil { return err } reConfiguration, err := container.Get[configurator.ReConfiguration](c) if err != nil { return err } informer, err := container.Get[logger.Informer](c) if err != nil { return err } reConfiguration.Registration(server) informer.Info("http.server: registration in the reConfigurator") return server.Serve(closer.GetContext()) }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func NewWithConfigurator ¶
func NewWithConfigurator(configurator configurator.Configurator, config *Config, router router.Router, logger logger.Logger) *HTTPServer
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(logger logger.Logger, router router.Router, config *Config, configurator configurator.Configurator) *ReConfiguration
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
func (*ReConfiguration) Serve ¶
func (reConfiguration *ReConfiguration) Serve(ctx context.Context) error
func (*ReConfiguration) Server ¶
func (reConfiguration *ReConfiguration) Server() Server
Click to show internal directories.
Click to hide internal directories.