Documentation
¶
Overview ¶
Package config provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.2 DO NOT EDIT.
Index ¶
Constants ¶
const (
DefaultMetricPath = "/metrics"
)
Variables ¶
var ( ErrListenAddressMissing = errors.New("server.listen_address is required") ErrCorsBadMaxAge = errors.New("invalid value of CORS max_age") )
Functions ¶
func GetSpec ¶ added in v0.0.4
GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.
func GetSpecJSON ¶ added in v0.0.4
GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.
func GetSwagger
deprecated
added in
v0.0.4
Types ¶
type CorsConfig ¶
type CorsConfig struct {
// AllowedOrigins AllowedOrigins controls value of Access-Control-Allow-Origin header.
AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"`
// MaxAge MaxAge controls value of Access-Control-Max-Age header.
MaxAge int `json:"max_age" yaml:"max_age"`
}
CorsConfig CORS configuration
type ServerConfig ¶
type ServerConfig struct {
// APIPrefix API prefix
APIPrefix string `json:"api_prefix" yaml:"api_prefix"`
// Cors CORS configuration
Cors *CorsConfig `json:"cors,omitempty" yaml:"cors,omitempty"`
// IdleTimeout Idle timeout
IdleTimeout *time.Duration `json:"idle_timeout,omitempty" yaml:"idle_timeout,omitempty"`
// ListenAddress Address to listen on
ListenAddress string `json:"listen_address" yaml:"listen_address"`
// ReadHeaderTimeout HTTP headers receive timeout
ReadHeaderTimeout *time.Duration `json:"read_header_timeout,omitempty" yaml:"read_header_timeout,omitempty"`
// ReadTimeout HTTP read timeout
ReadTimeout *time.Duration `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"`
// Telemetry Telemetry configuration
Telemetry *TelemetryConfig `json:"telemetry,omitempty" yaml:"telemetry,omitempty"`
// TLS TLS configuration
TLS *TLSConfig `json:"tls,omitempty" yaml:"tls,omitempty"`
// WriteTimeout HTTP write timeout
WriteTimeout *time.Duration `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"`
}
ServerConfig Server configuration
func (*ServerConfig) BindFlags ¶ added in v0.0.2
func (s *ServerConfig) BindFlags(prefix string, pf *pflag.FlagSet)
func (*ServerConfig) Check ¶
func (s *ServerConfig) Check() error
Check checks if configuration is semantically valid
func (*ServerConfig) RunForever ¶
func (s *ServerConfig) RunForever(srv *http.Server) error
type TLSConfig ¶
type TLSConfig struct {
// CertFile Path to file with certificate bundle
CertFile string `json:"cert_file" yaml:"cert_file"`
// KeyFile Path to file with private key
KeyFile string `json:"key_file" yaml:"key_file"`
}
TLSConfig TLS configuration
type TelemetryConfig ¶
type TelemetryConfig struct {
// Enabled Whether the metrics instrumentation should be enabled
Enabled bool `json:"enabled" yaml:"enabled"`
// Path HTTP context where metrics should be exposed
Path string `json:"path" yaml:"path"`
}
TelemetryConfig Telemetry configuration