config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultLocation

func DefaultLocation() string

returns default location for config

func GetDefaultConfig

func GetDefaultConfig() map[string]any

returns default config

Types

type Config

type Config struct {
	Secret     string
	ConfigPath string
	Sinks      map[string]*sink.Sink
	Senders    map[string]sender.Sender
}

func FromFile

func FromFile(manager *manager.Manager, path string) (*Config, error)

tries to create config from file. If it doesn't exist it creates a file and writes default config to it

func FromMap

func FromMap(senderManager *manager.Manager, configMap map[string]any) (*Config, error)

tries to create config from given map[string]any

type ConfigParser

type ConfigParser interface {
	FromFile(bytes *[]byte) (map[string]any, error)
	ToFile(configMap map[string]any) (*[]byte, error)
}

describes interface that is able to serialize/deserialize config to/from given format

type YamlParser

type YamlParser struct {
}

func (*YamlParser) FromFile

func (yp *YamlParser) FromFile(bytes *[]byte) (map[string]any, error)

func (*YamlParser) ToFile

func (yp *YamlParser) ToFile(configMap map[string]any) (*[]byte, error)

Jump to

Keyboard shortcuts

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