clwebserver

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package clwebserver implements serving of HTTP

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, logs *zap.Logger, h http.Handler, _ *net.TCPListener) *http.Server

New inits the http server.

func NewListener

func NewListener(cfg Config) (*net.TCPListener, error)

NewListener provides a tcp connection listener for the webserver.

func Provide added in v0.17.0

func Provide() fx.Option

Provide dependencies.

Types

type Config

type Config struct {
	// BindAddrPort configures where the web server will listen for incoming tcp traffic
	BindAddrPort string `env:"BIND_ADDR_PORT" envDefault:"127.0.0.1:8282"`
	// HTTP read timeout, See: https://blog.cloudflare.com/exposing-go-on-the-internet/
	ReadTimeout time.Duration `env:"READ_TIMEOUT" envDefault:"5s"`
	// HTTP write timeout, See: https://blog.cloudflare.com/exposing-go-on-the-internet/
	WriteTimeout time.Duration `env:"WRITE_TIMEOUT" envDefault:"12s"`
	// HTTP idle timeout, See: https://blog.cloudflare.com/exposing-go-on-the-internet/
	IdleTimeout time.Duration `env:"IDLE_TIMEOUT" envDefault:"120s"`
}

Config configures the http server.

Jump to

Keyboard shortcuts

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