config

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpanProcessorSimple = "simple"
	SpanProcessorBatch  = "batch"
)

Variables

Functions

func DecodeTLSCipherSuiteHookFunc

func DecodeTLSCipherSuiteHookFunc(from reflect.Type, to reflect.Type, data any) (any, error)

func DecodeTLSMinVersionHookFunc

func DecodeTLSMinVersionHookFunc(from reflect.Type, to reflect.Type, data any) (any, error)

func StringToByteSizeHookFunc

func StringToByteSizeHookFunc() mapstructure.DecodeHookFunc

func ValidateConfig

func ValidateConfig(configPath string) error

Types

type BufferLimit

type BufferLimit struct {
	Read  bytesize.ByteSize `koanf:"read"  mapstructure:"read"`
	Write bytesize.ByteSize `koanf:"write" mapstructure:"write"`
}

type CORS

type CORS struct {
	AllowedOrigins   []string      `koanf:"allowed_origins"`
	AllowedMethods   []string      `koanf:"allowed_methods"`
	AllowedHeaders   []string      `koanf:"allowed_headers"`
	ExposedHeaders   []string      `koanf:"exposed_headers"`
	AllowCredentials bool          `koanf:"allow_credentials"`
	MaxAge           time.Duration `koanf:"max_age,string"`
}

type CacheConfig

type CacheConfig struct {
	Type   string         `koanf:"type"`
	Config map[string]any `koanf:"config"`
}

type Configuration

type Configuration struct {
	Serve                ServeConfig          `koanf:"serve"`
	Log                  LoggingConfig        `koanf:"log"`
	Tracing              TracingConfig        `koanf:"tracing"`
	Metrics              MetricsConfig        `koanf:"metrics"`
	Profiling            ProfilingConfig      `koanf:"profiling"`
	Cache                CacheConfig          `koanf:"cache"`
	Prototypes           *MechanismPrototypes `koanf:"mechanisms,omitempty"`
	Default              *DefaultRule         `koanf:"default_rule,omitempty"`
	Providers            RuleProviders        `koanf:"providers,omitempty"`
	SecretsReloadEnabled bool                 `koanf:"secrets_reload_enabled"`
}

func NewConfiguration

func NewConfiguration(envPrefix EnvVarPrefix, configFile ConfigurationPath) (*Configuration, error)

type ConfigurationPath

type ConfigurationPath string

type ConnectionsLimit

type ConnectionsLimit struct {
	MaxPerHost     int `koanf:"max_per_host"`
	MaxIdle        int `koanf:"max_idle"`
	MaxIdlePerHost int `koanf:"max_idle_per_host"`
}

type DefaultRule

type DefaultRule struct {
	BacktrackingEnabled bool              `koanf:"backtracking_enabled"`
	Execute             []MechanismConfig `koanf:"execute"`
	ErrorHandler        []MechanismConfig `koanf:"on_error"`
}

type EnvVarPrefix

type EnvVarPrefix string

type KeyStore

type KeyStore struct {
	Path     string `koanf:"path"     mapstructure:"path"`
	Password string `koanf:"password" mapstructure:"password"`
}

type LogFormat

type LogFormat int
const (
	LogTextFormat LogFormat = iota
	LogGelfFormat
)

func (LogFormat) String

func (f LogFormat) String() string

type LoggingConfig

type LoggingConfig struct {
	Format LogFormat     `koanf:"format,string"`
	Level  zerolog.Level `koanf:"level,string"`
}

func LogConfiguration

func LogConfiguration(configuration *Configuration) LoggingConfig

type Mechanism

type Mechanism struct {
	ID        string          `koanf:"id"`
	Type      string          `koanf:"type"`
	Config    MechanismConfig `koanf:"config"`
	Condition string          `koanf:"if"`
}

type MechanismConfig

type MechanismConfig map[string]any

func (*MechanismConfig) DeepCopyInto

func (in *MechanismConfig) DeepCopyInto(out *MechanismConfig)

type MechanismPrototypes

type MechanismPrototypes struct {
	Authenticators  []Mechanism `koanf:"authenticators"`
	Authorizers     []Mechanism `koanf:"authorizers"`
	Contextualizers []Mechanism `koanf:"contextualizers"`
	Finalizers      []Mechanism `koanf:"finalizers"`
	ErrorHandlers   []Mechanism `koanf:"error_handlers"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled bool `koanf:"enabled"`
}

func (MetricsConfig) Address

func (c MetricsConfig) Address() string

type OperationMode

type OperationMode int
const (
	DecisionMode OperationMode = iota
	ProxyMode
)

type ProfilingConfig

type ProfilingConfig struct {
	Enabled bool   `koanf:"enabled"`
	Host    string `koanf:"host"`
	Port    int    `koanf:"port"`
}

func (ProfilingConfig) Address

func (c ProfilingConfig) Address() string

type RespondConfig

type RespondConfig struct {
	Verbose bool `koanf:"verbose"`
	With    struct {
		Accepted            ResponseOverride `koanf:"accepted"`
		ArgumentError       ResponseOverride `koanf:"argument_error"`
		AuthenticationError ResponseOverride `koanf:"authentication_error"`
		AuthorizationError  ResponseOverride `koanf:"authorization_error"`
		CommunicationError  ResponseOverride `koanf:"communication_error"`
		InternalError       ResponseOverride `koanf:"internal_error"`
		NoRuleError         ResponseOverride `koanf:"no_rule_error"`
	} `koanf:"with"`
}

type ResponseOverride

type ResponseOverride struct {
	Code int `koanf:"code"`
}

type RuleProviders

type RuleProviders struct {
	FileSystem   map[string]any `koanf:"file_system,omitempty"`
	HTTPEndpoint map[string]any `koanf:"http_endpoint,omitempty"`
	CloudBlob    map[string]any `koanf:"cloud_blob,omitempty"`
	Kubernetes   map[string]any `koanf:"kubernetes,omitempty"`
}

type ServeConfig

type ServeConfig struct {
	Proxy      ServiceConfig `koanf:"proxy"`
	Decision   ServiceConfig `koanf:"decision"`
	Management ServiceConfig `koanf:"management"`
}

type ServiceConfig

type ServiceConfig struct {
	Host             string           `koanf:"host"`
	Port             int              `koanf:"port"`
	Timeout          Timeout          `koanf:"timeout"`
	BufferLimit      BufferLimit      `koanf:"buffer_limit"`
	ConnectionsLimit ConnectionsLimit `koanf:"connections_limit"`
	CORS             *CORS            `koanf:"cors,omitempty"`
	TLS              *TLS             `koanf:"tls,omitempty"`
	TrustedProxies   *[]string        `koanf:"trusted_proxies,omitempty"`
	Respond          RespondConfig    `koanf:"respond"`
}

func (ServiceConfig) Address

func (c ServiceConfig) Address() string

type TLS

type TLS struct {
	KeyStore     KeyStore        `koanf:"key_store"     mapstructure:"key_store"`
	KeyID        string          `koanf:"key_id"        mapstructure:"key_id"`
	CipherSuites TLSCipherSuites `koanf:"cipher_suites" mapstructure:"cipher_suites"`
	MinVersion   TLSMinVersion   `koanf:"min_version"   mapstructure:"min_version"`
}

type TLSCipherSuites

type TLSCipherSuites []uint16

func (TLSCipherSuites) OrDefault

func (s TLSCipherSuites) OrDefault() []uint16

type TLSMinVersion

type TLSMinVersion uint16

func (TLSMinVersion) OrDefault

func (v TLSMinVersion) OrDefault() uint16

type Timeout

type Timeout struct {
	Read  time.Duration `koanf:"read,string"  mapstructure:"read"`
	Write time.Duration `koanf:"write,string" mapstructure:"write"`
	Idle  time.Duration `koanf:"idle,string"  mapstructure:"idle"`
}

type TracingConfig

type TracingConfig struct {
	Enabled           bool   `koanf:"enabled"`
	SpanProcessorType string `koanf:"span_processor"`
}

type TrustStore

type TrustStore struct {
	Path string `koanf:"path" mapstructure:"path"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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