config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArgument = stderrors.New("invalid argument")

ErrInvalidArgument is the error returned by ParseFlags or FromYAMLFile if its parsing result cannot be stored in the value pointed to by the designated passed argument which must be a non-nil pointer.

Functions

func FromYAMLFile

func FromYAMLFile(name string, v Validator) error

FromYAMLFile parses the given YAML file and stores the result in the value pointed to by v. If v is nil or not a pointer, FromYAMLFile returns an ErrInvalidArgument error.

func ParseFlags

func ParseFlags(v any) error

ParseFlags parses CLI flags and stores the result in the value pointed to by v. If v is nil or not a pointer, ParseFlags returns an ErrInvalidArgument error. ParseFlags adds a default Help Options group, which contains the options -h and --help. If either option is specified on the command line, ParseFlags prints the help message to os.Stdout and exits. Note that errors are not printed automatically, so error handling is the sole responsibility of the caller.

Types

type TLS

type TLS struct {
	Enable   bool   `yaml:"tls"`
	Cert     string `yaml:"cert"`
	Key      string `yaml:"key"`
	Ca       string `yaml:"ca"`
	Insecure bool   `yaml:"insecure"`
}

TLS provides TLS configuration options.

func (*TLS) MakeConfig

func (t *TLS) MakeConfig(serverName string) (*tls.Config, error)

MakeConfig assembles a tls.Config from t and serverName.

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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