config

package
Version: v0.18.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.17.0

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

DB holds the configuration settings needed to connect to a database.

func NewDB added in v0.17.0

func NewDB(opts ...Option) (DB, error)

NewDB returns the db configuration.

func (DB) DSN added in v0.17.0

func (db DB) DSN() string

DSN returns the datasource name for the database. The value is set from the <PREFIX_>DB_DSN environment variable.

func (DB) Driver added in v0.17.0

func (db DB) Driver() string

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

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 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 {
	Apply(*tls.Config)
}

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