cfg

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileRegex

func CompileRegex(s string) (*regexp.Regexp, error)

func ListToMap

func ListToMap(a []string) map[string]bool

func Parse

func Parse(ptr interface{}, values map[string]int) error

Parse holy shit! who write this function?

func ParseChild

func ParseChild(parent reflect.Value, v reflect.Value, values map[string]int) error

it isn't just a recursion it also captures values with the same name from parent i.e. take this config:

{
	"T": 10,
	"Child": { // has `child:true` in a tag
		"T": null
	}
}

this function will set `config.Child.T = config.T` see file.d/cfg/config_test.go:TestHierarchy for an example

func ParseField

func ParseField(v reflect.Value, vField reflect.Value, tField reflect.StructField, values map[string]int) error

func ParseFieldSelector

func ParseFieldSelector(selector string) []string

func ParseSlice

func ParseSlice(v reflect.Value, values map[string]int) error

ParseSlice recursively parses elements of an slice calls Parse, not ParseChild (!)

func UnescapeMap

func UnescapeMap(fields map[string]interface{}) map[string]string

Types

type Base8

type Base8 string

type Config

type Config struct {
	Vault        VaultConfig
	PanicTimeout time.Duration
	Pipelines    map[string]*PipelineConfig
}

func NewConfig

func NewConfig() *Config

func NewConfigFromFile

func NewConfigFromFile(path string) *Config

type Duration

type Duration string

type Expression

type Expression string

type FieldSelector

type FieldSelector string

type ListMap

type ListMap string

type PipelineConfig

type PipelineConfig struct {
	Raw *simplejson.Json
}

type Regexp

type Regexp string

type SubstitutionOp

type SubstitutionOp struct {
	Kind SubstitutionOpKind
	Data []string
}

func ParseSubstitution

func ParseSubstitution(substitution string) ([]SubstitutionOp, error)

type SubstitutionOpKind

type SubstitutionOpKind int
const (
	SubstitutionOpKindRaw SubstitutionOpKind = iota
	SubstitutionOpKindField
)

type VaultConfig

type VaultConfig struct {
	Token     string
	Address   string
	ShouldUse bool
}

Jump to

Keyboard shortcuts

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