config

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 16 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 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"`
	Signer   SignerConfig   `koanf:"signer"`
	Cache    CacheConfig    `koanf:"cache"`
	Pipeline PipelineConfig `koanf:"pipeline"`
	Rules    RulesConfig    `koanf:"rules,omitempty"`
}

func NewConfiguration

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

type ConfigurationPath

type ConfigurationPath string

type DefaultRuleConfig

type DefaultRuleConfig struct {
	Methods      []string         `koanf:"methods"`
	Execute      []map[string]any `koanf:"execute"`
	ErrorHandler []map[string]any `koanf:"on_error"`
}

type EnvVarPrefix

type EnvVarPrefix string

type FileBasedRuleProviderConfig

type FileBasedRuleProviderConfig struct {
	Src   string `koanf:"src"`
	Watch bool   `koanf:"watch"`
}

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 MetricsConfig

type MetricsConfig struct {
	Prometheus PrometheusConfig `koanf:"prometheus"`
}

type PipelineConfig

type PipelineConfig struct {
	Authenticators []PipelineObject `koanf:"authenticators"`
	Authorizers    []PipelineObject `koanf:"authorizers"`
	Hydrators      []PipelineObject `koanf:"hydrators"`
	Mutators       []PipelineObject `koanf:"mutators"`
	ErrorHandlers  []PipelineObject `koanf:"error_handlers"`
}

type PipelineObject

type PipelineObject struct {
	ID     string             `koanf:"id"`
	Type   PipelineObjectType `koanf:"type,string"`
	Config map[string]any     `koanf:"config"`
}

type PipelineObjectType

type PipelineObjectType string
const (
	POTNoop                PipelineObjectType = "noop"
	POTBasicAuth           PipelineObjectType = "basic_auth"
	POTAnonymous           PipelineObjectType = "anonymous"
	POTUnauthorized        PipelineObjectType = "unauthorized"
	POTOAuth2Introspection PipelineObjectType = "oauth2_introspection"
	POTJwt                 PipelineObjectType = "jwt"
	POTAllow               PipelineObjectType = "allow"
	POTDeny                PipelineObjectType = "deny"
	POTLocal               PipelineObjectType = "local"
	POTRemote              PipelineObjectType = "remote"
	POTDefault             PipelineObjectType = "default"
	POTGeneric             PipelineObjectType = "generic"
	POTHeader              PipelineObjectType = "header"
	POTCookie              PipelineObjectType = "cookie"
	POTRedirect            PipelineObjectType = "redirect"
	POTWWWAuthenticate     PipelineObjectType = "www_authenticate"
)

func (PipelineObjectType) String

func (p PipelineObjectType) String() string

type PrometheusConfig

type PrometheusConfig struct {
	Host        string `koanf:"host"`
	Port        int    `koanf:"port"`
	MetricsPath string `koanf:"metrics_path"`
}

func (PrometheusConfig) Address

func (c PrometheusConfig) Address() string

type RuleConfig

type RuleConfig struct {
	ID               string           `yaml:"id"`
	URL              string           `yaml:"url"`
	Upstream         string           `yaml:"upstream"`
	MatchingStrategy string           `yaml:"matching_strategy"`
	Methods          []string         `yaml:"methods"`
	Execute          []map[string]any `yaml:"execute"`
	ErrorHandler     []map[string]any `yaml:"on_error"`
}

type RuleProviders

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

type RulesConfig

type RulesConfig struct {
	Default   *DefaultRuleConfig `koanf:"default,omitempty"`
	Providers RuleProviders      `koanf:"providers"`
}

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"`
	VerboseErrors  bool      `koanf:"verbose_errors"`
	Timeout        Timeout   `koanf:"timeout"`
	CORS           *CORS     `koanf:"cors,omitempty"`
	TLS            *TLS      `koanf:"tls,omitempty"`
	TrustedProxies *[]string `koanf:"trusted_proxies,omitempty"`
}

func (ServiceConfig) Address

func (c ServiceConfig) Address() string

type SignerConfig

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

type TLS

type TLS struct {
	Key          string          `koanf:"key"`
	Cert         string          `koanf:"cert"`
	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