config

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 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 DataSourceNamer added in v0.8.0

type DataSourceNamer interface {
	// DSN returns the data source name of the sql database.
	DSN() string
}

DataSourceNamer is the interface that wraps the DSN method.

type Logger added in v0.8.0

type Logger interface {
	// Level returns the configured log level.
	Level() string
	// File returns the configured log file.
	File() string
	// Format returns the configured log format.
	Format() string
}

Logger provides the configuration settings for a logger.

func NewLogger added in v0.8.0

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

NewLogger returns the configuration of a logger.

type Option added in v0.1.1

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

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 Postgres added in v0.8.0

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

Postgres holds the configuration settings needed to connect to a postgres database. The DB, HOST and SSLMODE variables are required. The SSLMODE defaults to "enabled".

For sslmode setting, see https://www.postgresql.org/docs/current/libpq-ssl.html

func NewPostgres added in v0.8.0

func NewPostgres(opts ...Option) (*Postgres, error)

NewPostgres returns the postgres configuration.

func (*Postgres) DSN added in v0.8.0

func (p *Postgres) DSN() string

DSN returns a connection string corresponding to the postgres configuration.

See https://godoc.org/github.com/lib/pq for connection string parameters.

type SQLDatabase added in v0.8.0

type SQLDatabase interface {
	// DriverName returns the name of the sql database driver.
	DriverName() string
	DataSourceNamer
}

SQLDatabase holds the configuration information for an SQL database.

func NewSQLDatabase added in v0.8.0

func NewSQLDatabase(opts ...Option) (SQLDatabase, error)

NewSQLDatabase returns the configuration of an SQL database.

type Server added in v0.8.0

type Server interface {
	// Addr returns the network address the server will listen on.
	Addr() string

	// Cert returns the filepath of the certificate.
	Cert() string

	// Key returns the filepath of the certificate key.
	Key() string

	// CACert returns the filepath of the certificate of the client CA.
	// This is used when a mutual TLS connection is desired.
	CACert() string
}

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.

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