config

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: MPL-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultLogLevel = "WARN"

	DefaultReloadSignal = syscall.SIGHUP

	DefaultKillSignal = syscall.SIGINT
)
View Source
const (
	DefaultRetryAttempts   = 12
	DefaultRetryBackoff    = 250 * time.Millisecond
	DefaultRetryMaxBackoff = 1 * time.Minute
)
View Source
const (
	DefaultDialKeepAlive       = 30 * time.Second
	DefaultDialTimeout         = 30 * time.Second
	DefaultIdleConnTimeout     = 90 * time.Second
	DefaultMaxIdleConns        = 100
	DefaultTLSHandshakeTimeout = 10 * time.Second
)
View Source
const (
	DefaultSSLVerify = true
)
View Source
const (
	DefaultSyslogFacility = "LOCAL0"
)

Variables

View Source
var (
	DefaultMaxIdleConnsPerHost = runtime.GOMAXPROCS(0) + 1
)
View Source
var (
	ErrAuthStringEmpty = errors.New("auth: cannot be empty")
)

Functions

func Bool

func Bool(b bool) *bool

func BoolGoString

func BoolGoString(b *bool) string

func BoolPresent

func BoolPresent(b *bool) bool

func BoolVal

func BoolVal(b *bool) bool

func ConsulStringToStructFunc

func ConsulStringToStructFunc() mapstructure.DecodeHookFunc

func FileMode

func FileMode(o os.FileMode) *os.FileMode

func FileModeGoString

func FileModeGoString(o *os.FileMode) string

func FileModePresent

func FileModePresent(o *os.FileMode) bool

func FileModeVal

func FileModeVal(o *os.FileMode) os.FileMode

func Int

func Int(i int) *int

func IntGoString

func IntGoString(i *int) string

func IntPresent

func IntPresent(i *int) bool

func IntVal

func IntVal(i *int) int

func Signal

func Signal(s os.Signal) *os.Signal

func SignalGoString

func SignalGoString(s *os.Signal) string

func SignalPresent

func SignalPresent(s *os.Signal) bool

func SignalVal

func SignalVal(s *os.Signal) os.Signal

func String

func String(s string) *string

func StringGoString

func StringGoString(s *string) string

func StringPresent

func StringPresent(s *string) bool

func StringToFileModeFunc

func StringToFileModeFunc() mapstructure.DecodeHookFunc

func StringVal

func StringVal(s *string) string

func TimeDuration

func TimeDuration(t time.Duration) *time.Duration

func TimeDurationGoString

func TimeDurationGoString(t *time.Duration) string

func TimeDurationPresent

func TimeDurationPresent(t *time.Duration) bool

func TimeDurationVal

func TimeDurationVal(t *time.Duration) time.Duration

Types

type AuthConfig

type AuthConfig struct {
	Enabled  *bool   `mapstructure:"enabled"`
	Username *string `mapstructure:"username"`
	Password *string `mapstructure:"password"`
}

func DefaultAuthConfig

func DefaultAuthConfig() *AuthConfig

func ParseAuthConfig

func ParseAuthConfig(s string) (*AuthConfig, error)

func (*AuthConfig) Copy

func (c *AuthConfig) Copy() *AuthConfig

func (*AuthConfig) Finalize

func (c *AuthConfig) Finalize()

func (*AuthConfig) GoString

func (c *AuthConfig) GoString() string

func (*AuthConfig) Merge

func (c *AuthConfig) Merge(o *AuthConfig) *AuthConfig

func (*AuthConfig) String

func (c *AuthConfig) String() string

type Config

type Config struct {
	Consul       *ConsulConfig  `mapstructure:"consul"`
	KillSignal   *os.Signal     `mapstructure:"kill_signal"`
	LogLevel     *string        `mapstructure:"log_level"`
	PidFile      *string        `mapstructure:"pid_file"`
	ReloadSignal *os.Signal     `mapstructure:"reload_signal"`
	Syslog       *SyslogConfig  `mapstructure:"syslog"`
	From         *string        `mapstructure:"from"`
	To           *string        `mapstructure:"to"`
	Interval     *time.Duration `mapstructure:"interval"`
}

func DefaultConfig

func DefaultConfig() *Config

func FromFile

func FromFile(path string) (*Config, error)

func FromPath

func FromPath(path string) (*Config, error)

func Must

func Must(s string) *Config

func Parse

func Parse(s string) (*Config, error)

func TestConfig

func TestConfig(c *Config) *Config

func (*Config) Copy

func (c *Config) Copy() *Config

func (*Config) Finalize

func (c *Config) Finalize()

func (*Config) GoString

func (c *Config) GoString() string

func (*Config) Merge

func (c *Config) Merge(o *Config) *Config

type ConsulConfig

type ConsulConfig struct {
	Address *string

	Auth *AuthConfig `mapstructure:"auth"`

	Retry *RetryConfig `mapstructure:"retry"`

	SSL *SSLConfig `mapstructure:"ssl"`

	Token *string

	Transport *TransportConfig `mapstructure:"transport"`
}

func DefaultConsulConfig

func DefaultConsulConfig() *ConsulConfig

func (*ConsulConfig) Copy

func (c *ConsulConfig) Copy() *ConsulConfig

func (*ConsulConfig) Finalize

func (c *ConsulConfig) Finalize()

func (*ConsulConfig) GoString

func (c *ConsulConfig) GoString() string

func (*ConsulConfig) Merge

func (c *ConsulConfig) Merge(o *ConsulConfig) *ConsulConfig

type EnvConfig

type EnvConfig struct {
	Blacklist []string `mapstructure:"blacklist"`
	Custom    []string `mapstructure:"custom"`
	Pristine  *bool    `mapstructure:"pristine"`
	Whitelist []string `mapstructure:"whitelist"`
}

func DefaultEnvConfig

func DefaultEnvConfig() *EnvConfig

func (*EnvConfig) Copy

func (c *EnvConfig) Copy() *EnvConfig

func (*EnvConfig) Env

func (c *EnvConfig) Env() []string

func (*EnvConfig) Finalize

func (c *EnvConfig) Finalize()

func (*EnvConfig) GoString

func (c *EnvConfig) GoString() string

func (*EnvConfig) Merge

func (c *EnvConfig) Merge(o *EnvConfig) *EnvConfig

type RetryConfig

type RetryConfig struct {
	Attempts   *int
	Backoff    *time.Duration
	MaxBackoff *time.Duration `mapstructure:"max_backoff"`
	Enabled    *bool
}

func DefaultRetryConfig

func DefaultRetryConfig() *RetryConfig

func (*RetryConfig) Copy

func (c *RetryConfig) Copy() *RetryConfig

func (*RetryConfig) Finalize

func (c *RetryConfig) Finalize()

func (*RetryConfig) GoString

func (c *RetryConfig) GoString() string

func (*RetryConfig) Merge

func (c *RetryConfig) Merge(o *RetryConfig) *RetryConfig

func (*RetryConfig) RetryFunc

func (c *RetryConfig) RetryFunc() RetryFunc

type RetryFunc

type RetryFunc func(int) (bool, time.Duration)

type SSLConfig

type SSLConfig struct {
	CaCert     *string `mapstructure:"ca_cert"`
	CaPath     *string `mapstructure:"ca_path"`
	Cert       *string `mapstructure:"cert"`
	Enabled    *bool   `mapstructure:"enabled"`
	Key        *string `mapstructure:"key"`
	ServerName *string `mapstructure:"server_name"`
	Verify     *bool   `mapstructure:"verify"`
}

func DefaultSSLConfig

func DefaultSSLConfig() *SSLConfig

func (*SSLConfig) Copy

func (c *SSLConfig) Copy() *SSLConfig

func (*SSLConfig) Finalize

func (c *SSLConfig) Finalize()

func (*SSLConfig) GoString

func (c *SSLConfig) GoString() string

func (*SSLConfig) Merge

func (c *SSLConfig) Merge(o *SSLConfig) *SSLConfig

type SyslogConfig

type SyslogConfig struct {
	Enabled  *bool   `mapstructure:"enabled"`
	Facility *string `mapstructure:"facility"`
}

func DefaultSyslogConfig

func DefaultSyslogConfig() *SyslogConfig

func (*SyslogConfig) Copy

func (c *SyslogConfig) Copy() *SyslogConfig

func (*SyslogConfig) Finalize

func (c *SyslogConfig) Finalize()

func (*SyslogConfig) GoString

func (c *SyslogConfig) GoString() string

func (*SyslogConfig) Merge

func (c *SyslogConfig) Merge(o *SyslogConfig) *SyslogConfig

type TransportConfig

type TransportConfig struct {
	DialKeepAlive       *time.Duration `mapstructure:"dial_keep_alive"`
	DialTimeout         *time.Duration `mapstructure:"dial_timeout"`
	DisableKeepAlives   *bool          `mapstructure:"disable_keep_alives"`
	IdleConnTimeout     *time.Duration `mapstructure:"idle_conn_timeout"`
	MaxIdleConns        *int           `mapstructure:"max_idle_conns"`
	MaxIdleConnsPerHost *int           `mapstructure:"max_idle_conns_per_host"`
	TLSHandshakeTimeout *time.Duration `mapstructure:"tls_handshake_timeout"`
}

func DefaultTransportConfig

func DefaultTransportConfig() *TransportConfig

func (*TransportConfig) Copy

func (c *TransportConfig) Copy() *TransportConfig

func (*TransportConfig) Finalize

func (c *TransportConfig) Finalize()

func (*TransportConfig) GoString

func (c *TransportConfig) GoString() string

func (*TransportConfig) Merge

Jump to

Keyboard shortcuts

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