config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 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() string
}

DataSourceNamer is the interface that wraps the DSN method.

type Logger added in v0.8.0

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

Logger holds 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.

func (*Logger) File added in v0.8.0

func (l *Logger) File() string

File returns the configured log file.

func (*Logger) Format added in v0.8.0

func (l *Logger) Format() string

Format returns the configured log format.

func (*Logger) Level added in v0.8.0

func (l *Logger) Level() string

Level returns the configured log level.

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 struct {
	DataSourceNamer
	// contains filtered or unexported fields
}

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.

func (*SQLDatabase) DriverName added in v0.8.0

func (db *SQLDatabase) DriverName() string

DriverName returns the name of the sql database driver.

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.

func (*Server) CACert added in v0.8.0

func (s *Server) CACert() string

CACert returns the filepath of the certificate of the client CA. This is used when a mutual TLS connection is desired.

func (*Server) Cert added in v0.8.0

func (s *Server) Cert() string

Cert returns the filepath of the certificate.

func (*Server) Key added in v0.8.0

func (s *Server) Key() string

Key returns the filepath of the certificate key.

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