config

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTLS added in v0.7.0

func NewTLS(config TLS, opts ...TLSOption) (*tls.Config, error)

NewTLS will create a *tls.Config given the config and 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.

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.

func (Server) CACert added in v0.8.0

func (s Server) 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_>SERVER_CACERT environment variable.

func (Server) Cert added in v0.8.0

func (s Server) Cert() string

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

func (Server) Key added in v0.8.0

func (s Server) Key() string

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

type TLS added in v0.7.0

type TLS interface {
	// Cert returns the file name of the PEM encoded public key.
	Cert() string

	// Key returns the file name of the PEM encoded private key.
	Key() string

	// CACert returns the file name of the PEM encoded public key of the client CA.
	CACert() string
}

TLS contains the information necessary to create a tls.Config.

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