config

package
v0.9.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

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

Variables

nolint

Functions

func ValidateConfig

func ValidateConfig(configPath string) error

Types

type BufferLimit

type BufferLimit struct {
	Read  bytesize.ByteSize `koanf:"read"`
	Write bytesize.ByteSize `koanf:"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"`
}

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"`
	Signer    SignerConfig    `koanf:"signer"`
	Cache     CacheConfig     `koanf:"cache"`
	Rules     Rules           `koanf:"rules,omitempty"`
}

func NewConfiguration

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

type ConfigurationPath

type ConfigurationPath string

type DefaultRule

type DefaultRule struct {
	Methods      []string          `koanf:"methods"`
	Execute      []MechanismConfig `koanf:"execute"`
	ErrorHandler []MechanismConfig `koanf:"on_error"`
}

type EnvVarPrefix

type EnvVarPrefix string

type KeyStore

type KeyStore struct {
	Path     string `koanf:"path"`
	Password string `koanf:"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"`
}

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"`
	Unifiers        []Mechanism `koanf:"unifiers"`
	ErrorHandlers   []Mechanism `koanf:"error_handlers"`
}

type MetricsConfig

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

func (MetricsConfig) Address

func (c MetricsConfig) Address() string

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"`
		BadMethodError      ResponseOverride `koanf:"method_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 Rules

type Rules struct {
	Prototypes *MechanismPrototypes `koanf:"mechanisms,omitempty"`
	Default    *DefaultRule         `koanf:"default,omitempty"`
	Providers  RuleProviders        `koanf:"providers,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"`
	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 SignerConfig

type SignerConfig struct {
	Name     string   `koanf:"name"`
	KeyStore KeyStore `koanf:"key_store"`
	KeyID    string   `koanf:"key_id"`
}

type TLS

type TLS struct {
	KeyStore     KeyStore        `koanf:"key_store"`
	KeyID        string          `koanf:"key_id"`
	CipherSuites TLSCipherSuites `koanf:"cipher_suites"`
	MinVersion   TLSMinVersion   `koanf:"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"`
	Write time.Duration `koanf:"write,string"`
	Idle  time.Duration `koanf:"idle,string"`
}

type TracingConfig

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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