config

package
v0.0.0-...-fbaf9a3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const (
	HTTPBindAddress          = "http-bind-address"
	HTTPBindPort             = "http-bind-port"
	HTTPGracefulTimeout      = "http-graceful-timeout"
	HTTPLogRequests          = "http-log-requests"
	HTTPCORSEnabled          = "http-cors-enabled"
	HTTPCORSAllowOrigins     = "http-cors-allow-origins"
	HTTPCORSAllowMethods     = "http-cors-allow-methods"
	HTTPCORSAllowHeaders     = "http-cors-allow-headers"
	HTTPCORSAllowCredentials = "http-cors-allow-credentials"
	HTTPCORSExposeHeaders    = "http-cors-expose-headers"
	HTTPCORSMaxAge           = "http-cors-max-age"
	HTTPTLSCertFile          = "http-tls-cert-file"
	HTTPTLSKeyFile           = "http-tls-key-file"
)

Variables

View Source
var DefaultConfig = &Config{
	BindAddress: net.ParseIP("127.0.0.1"),
	BindPort:    1323,
	CORSEnabled: false,
	CORS: middleware.CORSConfig{
		AllowOrigins: []string{"*"},
		AllowMethods: []string{
			http.MethodGet,
			http.MethodHead,
			http.MethodPut,
			http.MethodPatch,
			http.MethodPost,
			http.MethodDelete,
		},
		AllowHeaders:     []string{},
		AllowCredentials: false,
		ExposeHeaders:    []string{},
		MaxAge:           0,
	},
	GracefulTimeout: 30 * time.Second,
	LogRequests:     true,
	TLS: &TLS{
		CertFile: "",
		KeyFile:  "",
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	BindAddress     net.IP
	BindPort        uint
	CORS            middleware.CORSConfig
	CORSEnabled     bool
	GracefulTimeout time.Duration
	LogRequests     bool
	TLS             *TLS
}

Config holds all HTTP configuration.

func (*Config) BindFlags

func (c *Config) BindFlags(fs *pflag.FlagSet)

BindFlags adds all the flags from the command line.

type TLS

type TLS struct {
	CertFile string
	KeyFile  string
}

Jump to

Keyboard shortcuts

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