template

package
v0.0.0-...-32a2ef5 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptySrc = errors.New("empty src template")

Functions

func Base64Decode

func Base64Decode(data string) (string, error)

func Base64Encode

func Base64Encode(data string) string

func CreateMap

func CreateMap(values ...interface{}) (map[string]interface{}, error)

CreateMap creates a key-value map of string -> interface{} The i'th is the key and the i+1 is the value

func Getenv

func Getenv(key string, v ...string) string

Getenv retrieves the value of the environment variable named by the key. It returns the value, which will the default value if the variable is not present. If no default value was given - returns "".

func LookupIP

func LookupIP(data string) []string

func LookupIPV4

func LookupIPV4(data string) []string

func LookupIPV6

func LookupIPV6(data string) []string

func LookupSRV

func LookupSRV(service, proto, name string) []*net.SRV

func Process

func Process(config Config) error

func Reverse

func Reverse(values interface{}) interface{}

Reverse returns the array in reversed order works with []string and []KVPair

func Seq

func Seq(first, last int) []int

Seq creates a sequence of integers. It's named and used as GNU's seq. Seq takes the first and the last element as arguments. So Seq(3, 5) will generate [3,4,5]

func SortByLength

func SortByLength(values []string) []string

func SortKVByLength

func SortKVByLength(values []memkv.KVPair) []memkv.KVPair

func UnmarshalJsonArray

func UnmarshalJsonArray(data string) ([]interface{}, error)

func UnmarshalJsonObject

func UnmarshalJsonObject(data string) (map[string]interface{}, error)

Types

type Config

type Config struct {
	ConfDir       string `toml:"confdir"`
	ConfigDir     string
	KeepStageFile bool
	Noop          bool   `toml:"noop"`
	Prefix        string `toml:"prefix"`
	StoreClient   backends.StoreClient
	SyncOnly      bool `toml:"sync-only"`
	TemplateDir   string
}

type Processor

type Processor interface {
	Process()
}

func IntervalProcessor

func IntervalProcessor(config Config, stopChan, doneChan chan bool, errChan chan error, interval int) Processor

func WatchProcessor

func WatchProcessor(config Config, stopChan, doneChan chan bool, errChan chan error) Processor

type TemplateResource

type TemplateResource struct {
	CheckCmd  string `toml:"check_cmd"`
	Dest      string
	FileMode  os.FileMode
	Gid       int
	Keys      []string
	Mode      string
	Prefix    string
	ReloadCmd string `toml:"reload_cmd"`
	Src       string
	StageFile *os.File
	Uid       int

	PGPPrivateKey []byte
	// contains filtered or unexported fields
}

TemplateResource is the representation of a parsed template resource.

func NewTemplateResource

func NewTemplateResource(path string, config Config) (*TemplateResource, error)

NewTemplateResource creates a TemplateResource.

type TemplateResourceConfig

type TemplateResourceConfig struct {
	TemplateResource TemplateResource `toml:"template"`
}

TemplateResourceConfig holds the parsed template resource.

Jump to

Keyboard shortcuts

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