cfg

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergedConfig

func MergedConfig(configPath string) ([]byte, error)

Types

type BlockListConfig

type BlockListConfig struct {
	Format         string `yaml:"format"`
	Endpoint       string `yaml:"endpoint"`
	Authentication struct {
		Type       string   `yaml:"type"`
		User       string   `yaml:"user"`
		Password   string   `yaml:"password"`
		Token      string   `yaml:"token"`
		TrustedIPs []string `yaml:"trusted_ips"`
	} `yaml:"authentication"`
}

type Config

type Config struct {
	CrowdsecConfig   CrowdsecConfig     `yaml:"crowdsec_config"`
	Blocklists       []*BlockListConfig `yaml:"blocklists"`
	ListenURI        string             `yaml:"listen_uri"`
	TLS              TLSConfig          `yaml:"tls"`
	Metrics          MetricConfig       `yaml:"metrics"`
	Logging          LoggingConfig      `yaml:",inline"`
	ConfigVersion    string             `yaml:"config_version"`
	EnableAccessLogs bool               `yaml:"enable_access_logs"`
}

func NewConfig

func NewConfig(reader io.Reader) (Config, error)

func (*Config) ValidateAndSetDefaults

func (cfg *Config) ValidateAndSetDefaults() error

type CrowdsecConfig

type CrowdsecConfig struct {
	LapiKey                    string   `yaml:"lapi_key"`
	LapiURL                    string   `yaml:"lapi_url"`
	UpdateFrequency            string   `yaml:"update_frequency"`
	InsecureSkipVerify         bool     `yaml:"insecure_skip_verify"`
	CertPath                   string   `yaml:"cert_path"`
	KeyPath                    string   `yaml:"key_path"`
	CAPath                     string   `yaml:"ca_cert_path"`
	IncludeScenariosContaining []string `yaml:"include_scenarios_containing"`
	ExcludeScenariosContaining []string `yaml:"exclude_scenarios_containing"`
	OnlyIncludeDecisionsFrom   []string `yaml:"only_include_decisions_from"`
}

type LoggingConfig

type LoggingConfig struct {
	LogLevel     *log.Level `yaml:"log_level"`
	LogMedia     string     `yaml:"log_media"`
	LogDir       string     `yaml:"log_dir"`
	LogMaxSize   int        `yaml:"log_max_size,omitempty"`
	LogMaxFiles  int        `yaml:"log_max_backups,omitempty"`
	LogMaxAge    int        `yaml:"log_max_age,omitempty"`
	CompressLogs *bool      `yaml:"compress_logs,omitempty"`
}

func (*LoggingConfig) LoggerForFile

func (c *LoggingConfig) LoggerForFile(fileName string) (io.Writer, error)

type MetricConfig

type MetricConfig struct {
	Enabled  bool   `yaml:"enabled"`
	Endpoint string `yaml:"endpoint"`
}

type TLSConfig

type TLSConfig struct {
	CertFile string `yaml:"cert_file"`
	KeyFile  string `yaml:"key_file"`
}

Jump to

Keyboard shortcuts

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