config

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger added in v0.8.0

type Logger struct {
	// contains filtered or unexported fields
}

Logger holds the configuration information for a logger.

func NewLogger added in v0.8.0

func NewLogger(opts ...Option) (Logger, error)

NewLogger returns the configuration of a logger.

func (Logger) Format added in v0.8.0

func (l Logger) Format() string

Format returns the logging format for the logger. The value is set from the <PREFIX_>LOG_FORMAT environment variable.

func (Logger) Level added in v0.8.0

func (l Logger) Level() string

Level returns the logging level for the logger. The value is set from the <PREFIX_>LOG_LEVEL environment variable.

type Option added in v0.1.1

type Option interface {
	Apply(*Options)
}

Option provides options when loading configuration information.

func WithPrefix added in v0.1.1

func WithPrefix(prefix string) Option

WithPrefix adds a prefix to the name of the enviroment variables being referenced.

type Options added in v0.1.1

type Options struct {
	// Prefix, if set, will require the prefix to be present in the name of the
	// environment variables associated with the config object.
	Prefix string
}

Options hold the config package options.

type SQL added in v0.9.0

type SQL struct {
	// contains filtered or unexported fields
}

SQL holds the configuration settings needed to connect to an sql database.

func NewSQL added in v0.9.0

func NewSQL(opts ...Option) (SQL, error)

NewSQL returns the sql configuration.

func (SQL) Driver added in v0.9.0

func (s SQL) Driver() string

Driver returns the sql database driver. The value is set from the <PREFIX_>SQL_DRIVER environment variable.

func (SQL) URL added in v0.9.0

func (s SQL) URL() string

URL returns the connection URL for the SQL database. The value is set from the <PREFIX_>SQL_URL environment variable.

type Server added in v0.8.0

type Server struct {
	// contains filtered or unexported fields
}

Server holds the configuration settings for a server.

func NewServer added in v0.8.0

func NewServer(opts ...Option) (Server, error)

NewServer returns the server configuration.

func (Server) Addr added in v0.8.0

func (s Server) Addr() string

Addr returns the network address the server will listen on. The value is set from the <PREFIX_>SERVER_ADDR environment variable.

type TLS added in v0.7.0

type TLS struct {
	// contains filtered or unexported fields
}

TLS holds the configuration settings for a TLS Cert.

func NewTLS added in v0.7.0

func NewTLS(opts ...Option) (TLS, error)

NewTLS returns the tls configuration.

func (TLS) CACert added in v0.7.0

func (t TLS) CACert() string

CACert returns the path of the certificate of the CA certificate file. This is used when creating a TLS connection with an entity that is presenting a certificate that is not signed by a well known CA available in the OS CA bundle. The value is set from the <PREFIX_>TLS_CACERT environment variable.

func (TLS) Cert added in v0.7.0

func (t TLS) Cert() string

Cert returns the path of the certificate file. The value is set from the <PREFIX_>TLS_CERT environment variable.

func (TLS) Key added in v0.7.0

func (t TLS) Key() string

Key returns the path of the certificate key file. The value is set from the <PREFIX_>TLS_KEY environment variable.

func (TLS) TLSConfig added in v0.10.0

func (t TLS) TLSConfig(opts ...TLSOption) (*tls.Config, error)

TLSConfig will create a *tls.Config given the options. This will return an error if there is a problem loading the required certificate files. If the WithMTLS option is specified, a client CA cert is required.

type TLSOption added in v0.7.0

type TLSOption interface {
	// contains filtered or unexported methods
}

TLSOption provides options for configuring the creation of a tls.Config.

func WithMTLS added in v0.7.0

func WithMTLS() TLSOption

WithMTLS will setup the tls.Config to require and verify client connections.

Jump to

Keyboard shortcuts

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