config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrCommandEmpty = xerrors.Errorf("command declaration is empty")
)

Functions

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 Bytes added in v0.1.5

type Bytes []byte

func (*Bytes) UnmarshalYAML added in v0.1.5

func (fd *Bytes) UnmarshalYAML(node *yaml.Node) error

type Command added in v0.0.9

type Command struct {
	Dir  string   `yaml:"dir"`
	Exec string   `yaml:"exec"`
	Args []string `yaml:"args,flow"`
}

func (*Command) UnmarshalYAML added in v0.0.14

func (c *Command) 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[[]Command] `yaml:"cmd,flow"`
	FS       []Section[[]string]  `yaml:"fs,flow"`
}

type File

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

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, templateFns map[string]any, templateOptions []string) *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 Script added in v0.1.0

type Script struct {
	Dir    string   `yaml:"dir"`
	Exec   string   `yaml:"exec"`
	Args   []string `yaml:"args,flow"`
	Script string   `yaml:"script,flow"`
}

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