config

package
v0.1.3-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// DataDir          string // used to store data about positions.
	MetricsEnabled   bool
	LogLevel         slog.Level
	HttpInputEnabled bool
	ListenAddress    string

	Inputs          []*input.Input
	Filters         []*filter.Filter
	Destinations    []*destination.Destination
	Transformations []*transformation.Transformation
	// contains filtered or unexported fields
}

func LoadHCL

func LoadHCL(fileName string, data []byte, opts ...ConfigOption) (*Config, error)

func New

func New(opts ...ConfigOption) *Config

func (*Config) Init

func (c *Config) Init()

type ConfigOption

type ConfigOption func(*Config)

func WithDestination

func WithDestination(id, kind string, bufferSize int, subscriptions []string, impl destination.DestinationProcessor) ConfigOption

func WithFilter

func WithFilter(id, kind string, bufferSize int, subscriptions []string, impl filter.FilterProcessor) ConfigOption

func WithInput

func WithInput(id, kind string, impl input.InputProcessor) ConfigOption

func WithListenAddress

func WithListenAddress(address string) ConfigOption

func WithLogLevel

func WithLogLevel(logLevel string) ConfigOption

func WithMetricsEnabled

func WithMetricsEnabled() ConfigOption

func WithTransformer

func WithTransformer(id, kind string, bufferSize int, subscriptions []string, transformer transformation.TransformerImpl) ConfigOption

type HclConfig

type HclConfig struct {
	DataDir        string `hcl:"data_dir,optional"`
	MetricsEnabled bool   `hcl:"metrics_enabled,optional"`
	LogLevel       string `hcl:"log_level,optional"`
	ListenAddress  string `hcl:"listen_address,optional"`
	// HttpInputEnabled bool
	Inputs          []HclConfigItem                  `hcl:"input,block"`
	Filters         []HclConfigItemWithSubscriptions `hcl:"filter,block"`
	Transformations []HclConfigItemWithSubscriptions `hcl:"transformation,block"`
	Destinations    []HclConfigItemWithSubscriptions `hcl:"destination,block"`
}

func (HclConfig) EvalContext

func (hc HclConfig) EvalContext() *hcl.EvalContext

type HclConfigItem

type HclConfigItem struct {
	Kind string   `hcl:"kind,label"`
	ID   string   `hcl:"id,label"`
	Body hcl.Body `hcl:",remain"`
}

type HclConfigItemWithSubscriptions

type HclConfigItemWithSubscriptions struct {
	Kind          string   `hcl:"kind,label"`
	ID            string   `hcl:"id,label"`
	BufferSize    int      `hcl:"buffer_size,optional"`
	Subscriptions []string `hcl:"subscriptions"`
	Body          hcl.Body `hcl:",remain"`
}

Jump to

Keyboard shortcuts

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