config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagDirs      = "dirs"
	TagFiles     = "files"
	TagCmd       = "cmd"
	SettingsHTTP = "settings"
)

Variables

This section is empty.

Functions

func UnmarshalYamlFiles added in v0.0.2

func UnmarshalYamlFiles(rawConfig []byte) (map[string][]File, error)

func ValidateFile

func ValidateFile(file File) error

Types

type AddrURL

type AddrURL struct {
	*url.URL `yaml:",inline"`
}

func (*AddrURL) UnmarshalYAML

func (addr *AddrURL) UnmarshalYAML(unmarshal func(any) error) error

type Config

type Config struct {
	Settings Settings            `yaml:"settings"`
	Dirs     []Section[[]string] `yaml:"dirs,flow"`
	Files    []Section[[]File]   `yaml:"files,flow"`
	Cmd      []Section[[]string] `yaml:"cmd,flow"`
}

func PrepareFiles added in v0.0.2

func PrepareFiles(conf Config, files map[string][]File) (Config, error)

type File

type File struct {
	Path         string  `yaml:"path"`
	Data         *string `yaml:"data"`
	Get          *Get    `yaml:"get"`
	Local        *string `yaml:"local"`
	ExecTmplSkip bool    `yaml:"tmpl_skip"`
}

type Get

type Get struct {
	HTTPClientParams `yaml:",inline"`
	URL              string `yaml:"url"`
}

type HTTPClient added in v0.0.2

type HTTPClient struct {
	HTTPClientParams `yaml:",inline"`
	BaseURL          AddrURL `yaml:"base_url"`
	Debug            bool    `yaml:"debug"`
}

type HTTPClientParams added in v0.0.6

type HTTPClientParams struct {
	Headers     map[string]string `yaml:"headers"`
	QueryParams map[string]string `yaml:"query_params"`
}

type RawPreprocessor added in v0.0.6

type RawPreprocessor struct {
	// contains filtered or unexported fields
}

func NewRawPreprocessor added in v0.0.6

func NewRawPreprocessor(templateName string, templateVars map[string]any) *RawPreprocessor

func (*RawPreprocessor) Process added in v0.0.6

func (p *RawPreprocessor) Process(data []byte) ([]byte, map[string]any, error)

type Reader added in v0.0.5

type Reader struct {
	// contains filtered or unexported fields
}

func NewConfigReader added in v0.0.5

func NewConfigReader(f flag.Flags) *Reader

func (*Reader) Read added in v0.0.5

func (r *Reader) Read() ([]byte, error)

type Section added in v0.0.3

type Section[T any] struct {
	Line int32
	Tag  string
	Val  T
}

type Settings added in v0.0.6

type Settings struct {
	HTTP *HTTPClient `yaml:"http"`
}

type YamlUnmarshaler added in v0.0.6

type YamlUnmarshaler struct {
	// contains filtered or unexported fields
}

func NewYamlConfigUnmarshaler added in v0.0.6

func NewYamlConfigUnmarshaler(tagFilter *entity.RegexpChain, logger entity.Logger) *YamlUnmarshaler

func (*YamlUnmarshaler) Unmarshal added in v0.0.6

func (u *YamlUnmarshaler) Unmarshal(rawConfig []byte) (Config, error)

Jump to

Keyboard shortcuts

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