httpserver

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLabel   = "httpserver"
	DefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewWithConfig

func NewWithConfig(c Config) (*httpserver, error)

Create the server

Types

type Config

type Config struct {
	Label   string        `hcl:"label,label"`
	Router  Task          `hcl:"router,optional"`
	Addr    string        `hcl:"listen,optional"`  // Address or path for binding HTTP server
	TLS     *TLS          `hcl:"tls,block"`        // TLS parameters
	Timeout time.Duration `hcl:"timeout,optional"` // Read timeout on HTTP requests
}

func (Config) Name

func (c Config) Name() string

func (Config) New

func (c Config) New(ctx context.Context, provider Provider) (Task, error)

Return a new task. Label for the task can be retrieved from context

type TLS

type TLS struct {
	Key  string `hcl:"key"`  // Path to TLS Private Key
	Cert string `hcl:"cert"` // Path to TLS Certificate
}

Jump to

Keyboard shortcuts

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