Documentation
¶
Overview ¶
Package http2 provides an HTTP server comprised of multiple HTTP services
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ProvidersHTTP = wire.NewSet( ProvideHTTPServer, )
ProvidersHTTP are our wire superset of providers this package offers.
Functions ¶
func RegisterHTTPServer ¶
RegisterHTTPServer registers a Server with the injector. The serviceName parameter is passed directly rather than injected, since string is too generic a type to resolve unambiguously from the injector.
func RootLevelAssetsHandler ¶
func RootLevelAssetsHandler(assetsDir string) http.HandlerFunc
RootLevelAssetsHandler returns an http.HandlerFunc that serves static files from assetsDir. It only serves root-level files (no subdirectories) and guards against path traversal. Register with router.Get("/*", RootLevelAssetsHandler(assetsDir)) as the last route.
Types ¶
type Config ¶
type Config struct {
SSLCertificateFile string `env:"SSL_CERTIFICATE_FILEPATH" json:"sslsCertificate,omitempty"`
SSLCertificateKeyFile string `env:"SSL_CERTIFICATE_KEY_FILEPATH" json:"sslsCertificateKey,omitempty"`
StartupDeadline time.Duration `env:"STARTUP_DEADLINE" json:"startupDeadline,omitempty"`
Port uint16 `env:"PORT" json:"port"`
Debug bool `env:"DEBUG" json:"debug"`
// contains filtered or unexported fields
}
Config describes the settings pertinent to the HTTP serving portion of the service.
type Server ¶
func ProvideHTTPServer ¶
func ProvideHTTPServer( serverSettings Config, logger logging.Logger, router routing.Router, tracerProvider tracing.TracerProvider, serviceName string, ) (Server, error)
ProvideHTTPServer builds a new server instance. serviceName, when non-empty, is used for the server's logger; otherwise "api_server" is used.