Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CORS ¶
type CORS struct {
Origins []string `mapstructure:"origins" validate:"dive,required,url"`
}
CORS is a configuration for CORS middleware.
type Configurable ¶
type Configurable interface {
ServerCore() *Configuration
}
Configurable is an interface that can be implemented by extended configuration.
type Configuration ¶
type Configuration struct { *config.Configuration `mapstructure:",squash"` // Server configuration section. Server *Server `mapstructure:"server"` // CORS configuration section. CORS *CORS `mapstructure:"cors"` // Proxy configuration section. Proxy *Proxy `mapstructure:"proxy"` // Metrics configuration section. Metrics *Metrics `mapstructure:"metrics"` // HTTPClient configuration section. HTTPClient *http.Configuration `mapstructure:"http_client"` }
Configuration for the application.
func (*Configuration) Bind ¶
func (c *Configuration) Bind(_ string, v *viper.Viper)
Bind binds configuration section to viper.
func (*Configuration) BindCmd ¶
func (c *Configuration) BindCmd(cmd *cobra.Command, v *viper.Viper)
BindCmd adds configuration bindings from command arguments.
func (*Configuration) ServerCore ¶
func (c *Configuration) ServerCore() *Configuration
ServerCore returns the web core configuration.
func (*Configuration) Validate ¶
func (c *Configuration) Validate(validate *validation.Validate) error
Validate the configuration.
type Metrics ¶
type Metrics struct { Enabled bool `mapstructure:"enabled"` Path string `mapstructure:"path"` Address []string `mapstructure:"address" validate:"dive,required,ip_addr|cidr|eq=*"` SkipPaths []string `mapstructure:"skip_paths"` }
type Proxy ¶
type Proxy struct { Address []string `mapstructure:"address" validate:"dive,required,ip_addr|cidr|eq=*"` Limit int `mapstructure:"limit" validate:"min=0,max=10"` }
Proxy is a configuration for trusted proxies.
type Server ¶
type Server struct { HTTP *ServerHTTP `mapstructure:"http"` HTTPS *ServerHTTPS `mapstructure:"https"` Path string `mapstructure:"path"` }
Server configuration section.
type ServerHTTP ¶
type ServerHTTP struct { Enabled bool `mapstructure:"enabled"` Address string `mapstructure:"address" validate:"ip_addr|hostname|fqdn"` Port int `mapstructure:"port" validate:"required,min=1,max=65535"` }
ServerHTTP is a HTTP server configuration.
func (*ServerHTTP) Bind ¶
func (s *ServerHTTP) Bind(prefix string, v *viper.Viper)
Bind server configuration section.
func (*ServerHTTP) Validate ¶
func (s *ServerHTTP) Validate(valid *validation.Validate) error
Validate server configuration section.
type ServerHTTPS ¶
type ServerHTTPS struct { Enabled bool `mapstructure:"enabled"` Address string `mapstructure:"address" validate:"ip_addr|hostname|fqdn"` Port int `mapstructure:"port" validate:"required,min=1,max=65535"` CertificatePEMFile string `mapstructure:"certificate_pem_file" validate:"omitempty,file"` }
ServerHTTPS is a HTTPS server configuration.
func (*ServerHTTPS) Bind ¶
func (s *ServerHTTPS) Bind(prefix string, v *viper.Viper)
Bind server configuration section.
func (*ServerHTTPS) Validate ¶
func (s *ServerHTTPS) Validate(valid *validation.Validate) error
Validate server configuration section.