config

package
v0.0.0-...-c4656d9 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	ServerAddress        string `default:"localhost" env:"EXPORTER_HOST"                   yaml:"server_address"`
	ServerPort           int    `default:"8080"      env:"EXPORTER_PORT"                   yaml:"server_port"`
	RequestTimeout       int    `default:"10"        env:"EXPORTER_REQUEST_TIMEOUT"        yaml:"request_timeout"`
	TelemetryPath        string `default:"/metrics"  env:"EXPORTER_TELEMETRY_PATH"         yaml:"telemetry_path"`
	Enable               bool   `default:"true"      env:"EXPORTER_ENABLE"                 yaml:"enable"`
	EnableRequestLogging bool   `default:"true"      env:"EXPORTER_ENABLE_REQUEST_LOGGING" yaml:"enable_request_logging"`
	EnableRuntimeMetrics bool   `default:"false"     env:"EXPORTER_ENABLE_RUNTIME_METRICS" yaml:"enable_runtime_metrics"`
}

type LoggerConfig

type LoggerConfig struct {
	Level string `default:"debug" env:"LOG_LEVEL" yaml:"level"`
	File  string `default:""      env:"LOG_FILE"  yaml:"file"`
}

type StormControlConfig

type StormControlConfig struct {
	Watcher  WatcherConfig `yaml:"watcher"`
	Logger   LoggerConfig  `yaml:"logger"`
	Exporter Exporter      `yaml:"exporter"`
}

func ReadConfig

func ReadConfig(file string) (StormControlConfig, error)

func (*StormControlConfig) UnmarshalYAML

func (c *StormControlConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type WatcherConfig

type WatcherConfig struct {
	BlockDelay     int      `default:"10"             env:"BLOCK_DELAY"     yaml:"block_delay"`
	BlockEnabled   bool     `default:"false"          env:"BLOCK_ENABLED"   yaml:"block_enabled"`
	BlockThreshold uint64   `default:"100"            env:"BLOCK_THRESHOLD" yaml:"block_threshold"`
	StaticDevList  []string `default:"[]"             env:"STATIC_DEV_LIST" yaml:"device_list"`
	DevRegEx       string   `default:"^tap.{8}-.{2}$" env:"DEV_REGEX"       yaml:"device_regex"`
}

Jump to

Keyboard shortcuts

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