Documentation
¶
Overview ¶
Package config handles Skogul configuration parsing.
Index ¶
- func GetRelevantRawConfigSection(rawConfig *map[string]interface{}, family, section string) map[string]interface{}
- func VerifyOnlyRequiredConfigProps(componentConfig *map[string]interface{}, family, handler string, ...) []string
- type Config
- type Encoder
- type FieldDoc
- type Handler
- type Help
- type Parser
- type Receiver
- type Sender
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRelevantRawConfigSection ¶ added in v0.7.0
func GetRelevantRawConfigSection(rawConfig *map[string]interface{}, family, section string) map[string]interface{}
GetRelevantRawConfigSection is a helper function to dig down into a Config JSON and select the wanted family (receivers, transformers, senders) and item (foo).
func VerifyOnlyRequiredConfigProps ¶ added in v0.5.1
func VerifyOnlyRequiredConfigProps(componentConfig *map[string]interface{}, family, handler string, T reflect.Type) []string
VerifyOnlyRequiredConfigProps checks for undefined configuration properties It can be used to identify typos or invalid configuration Use 'config.GetRelevantRawConfigSection' first for handler if you have a full config.
Types ¶
type Config ¶
type Config struct { Handlers map[string]*Handler Receivers map[string]*Receiver Senders map[string]*Sender Parsers map[string]*Parser Encoders map[string]*Encoder Transformers map[string]*Transformer }
Config encapsulates all configuration for Skogul, and represent the top-level configuration object.
func Bytes ¶
Bytes parses json in the provided byte array and returns a configuration.
It does this by first doing a pass where it just does JSON unmarshalling, which also updates sender and handler reference tables globally (unfortunately...), then calling secondPass(), which resolves references and does a final validation.
func File ¶
File opens a config file and parses it, then returns the valid configuration, using Bytes()
type Encoder ¶ added in v0.15.1
Encoder wraps the skogul.Encoder module-type for configuration parsing.
func (*Encoder) MarshalJSON ¶ added in v0.15.1
MarshalJSON marshals Encoder config. See MarshalJSON for receiver - same same.
func (*Encoder) UnmarshalJSON ¶ added in v0.15.1
UnmarshalJSON for Parser. See UnmarshalJSON for Receiver - same same.
type FieldDoc ¶ added in v0.3.0
FieldDoc is a structured representation of the documentation of a single field in a struct, used for modules
type Handler ¶
type Handler struct { Parser skogul.ParserRef Transformers []*skogul.TransformerRef Sender skogul.SenderRef IgnorePartialFailures bool Handler skogul.Handler `json:"-"` }
Handler wraps skogul.Handler for configuration parsing.
type Help ¶
type Help struct { Name string Aliases string Doc string Fields map[string]FieldDoc CustomTypes map[string]map[string]FieldDoc AutoMake bool }
Help is the relevant help for a single module
type Parser ¶ added in v0.9.0
Parser wraps the skogul.Parser for configuration parsing.
func (*Parser) MarshalJSON ¶ added in v0.9.0
MarshalJSON marshals Parser config. See MarshalJSON for receiver - same same.
func (*Parser) UnmarshalJSON ¶ added in v0.9.0
UnmarshalJSON for Parser. See UnmarshalJSON for Receiver - same same.
type Receiver ¶
Receiver wraps the skogul.Receiver for configuration parsing.
func (*Receiver) MarshalJSON ¶
MarshalJSON for a receiver marshals the actual instantiated receiver, then merges it to add "type". Probably not the most efficient implementation, since it does marshal-unmarshal-merge-marshal, but since this isn't really performance sensitive, that's ok.
func (*Receiver) UnmarshalJSON ¶
UnmarshalJSON picks up the type of the Receiver, instantiates a copy of that receiver, then unmarshals the remaining configuration onto that.
type Sender ¶
Sender wraps the skogul.Sender for configuration parsing.
func (*Sender) MarshalJSON ¶
MarshalJSON marshals Sender config. See MarshalJSON for receiver - same same.
func (*Sender) UnmarshalJSON ¶
UnmarshalJSON for Sender. See UnmarshalJSON for Receiver - same same.
type Transformer ¶
type Transformer struct { Type string Transformer skogul.Transformer `json:"-"` }
Transformer wraps skogul.Transformer
func (*Transformer) MarshalJSON ¶ added in v0.28.0
func (t *Transformer) MarshalJSON() ([]byte, error)
MarshalJSON marshals Transformer config. See MarshalJSON for receiver - same same.
func (*Transformer) UnmarshalJSON ¶
func (t *Transformer) UnmarshalJSON(b []byte) error
UnmarshalJSON picks up the type of the Receiver, instantiates a copy of that receiver, then unmarshals the remaining configuration onto that.