Documentation
¶
Overview ¶
Package configuration is in charge of the validation and extraction of all the configuration details from a configuration file or environment variables.
Index ¶
- Constants
- type Registry
- func (c *Registry) GetGracefulTimeout() time.Duration
- func (c *Registry) GetHTTPAddress() string
- func (c *Registry) GetHTTPCompressResponses() bool
- func (c *Registry) GetHTTPIdleTimeout() time.Duration
- func (c *Registry) GetHTTPReadTimeout() time.Duration
- func (c *Registry) GetHTTPWriteTimeout() time.Duration
- func (c *Registry) GetLogLevel() string
- func (c *Registry) IsLogJSON() bool
Constants ¶
const ( // EnvPrefix will be used for environment variable name prefixing. EnvPrefix = "APP" // DefaultHTTPAddress is the address and port string that your service will // be exported to by default. DefaultHTTPAddress = "0.0.0.0:8080" // DefaultHTTPIdleTimeout specifies the default timeout for HTTP idling DefaultHTTPIdleTimeout = time.Second * 15 // DefaultHTTPCompressResponses compresses HTTP responses for clients that // support it via the 'Accept-Encoding' header. DefaultHTTPCompressResponses = false // DefaultLogLevel is the default log level used in your service. DefaultLogLevel = "info" // DefaultLogJSON is a switch to toggle on and off JSON log output. DefaultLogJSON = false // DefaultGracefulTimeout is the duration for which the server gracefully // wait for existing connections to finish - e.g. 15s or 1m DefaultGracefulTimeout = time.Second * 15 // DefaultHTTPWriteTimeout specifies the default timeout for HTTP writes DefaultHTTPWriteTimeout = time.Second * 15 // DefaultHTTPReadTimeout specifies the default timeout for HTTP reads DefaultHTTPReadTimeout = time.Second * 15 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry encapsulates the Viper configuration registry which stores the configuration data in-memory.
func New ¶
New creates a configuration reader object using a configurable configuration file path. If the provided config file path is empty, a default configuration will be created.
func (*Registry) GetGracefulTimeout ¶
GetGracefulTimeout returns the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m
func (*Registry) GetHTTPAddress ¶
GetHTTPAddress returns the HTTP address (as set via default, config file, or environment variable) that the app-server binds to (e.g. "0.0.0.0:8080")
func (*Registry) GetHTTPCompressResponses ¶
GetHTTPCompressResponses returns true if HTTP responses should be compressed for clients that support it via the 'Accept-Encoding' header.
func (*Registry) GetHTTPIdleTimeout ¶
GetHTTPIdleTimeout returns the duration for which
func (*Registry) GetHTTPReadTimeout ¶
GetHTTPReadTimeout returns the duration for which
func (*Registry) GetHTTPWriteTimeout ¶
GetHTTPWriteTimeout returns the duration for which
func (*Registry) GetLogLevel ¶
GetLogLevel returns the loggging level (as set via config file or environment variable)