Versions in this module Expand all Collapse all v0 v0.5.3 Jan 21, 2021 v0.5.2 Nov 18, 2020 v0.5.1 Nov 10, 2020 v0.5.0 Aug 19, 2020 v0.4.8 Feb 21, 2020 v0.4.7 Feb 13, 2020 v0.4.6 Jan 16, 2020 v0.4.5 Nov 10, 2019 v0.4.4 Nov 4, 2019 v0.4.3 Nov 1, 2019 Changes in this version + const TomlBackendType + func RegisterBackendClient(typeName string, newClient func(cfg *BackendConfig) (BackendClient, error)) + type Application struct + func NewApplication(cfg *Config, client BackendClient) *Application + func (p *Application) GetValues(keys ...string) + func (p *Application) Info(names ...string) + func (p *Application) List(re string) + func (p *Application) Make(names ...string) + func (p *Application) Run(opts ...Options) + type BackendClient interface + Close func() error + GetValues func(keys []string) (map[string]string, error) + Type func() string + WatchEnabled func() bool + WatchPrefix func(prefix string, keys []string, waitIndex uint64, stopChan chan bool) (uint64, error) + func MustNewBackendClient(cfg *BackendConfig, opts ...func(*BackendConfig)) BackendClient + func NewBackendClient(cfg *BackendConfig, opts ...func(*BackendConfig)) (BackendClient, error) + type BackendConfig struct + ClientCAKeys string + ClientCert string + ClientKey string + HookKeyAdjuster func(key string) (realKey string) + Host []string + Password string + Type string + UserName string + func LoadBackendConfig(path string) (p *BackendConfig, err error) + func LoadBackendConfigFromJsonString(s string) (p *BackendConfig, err error) + func MustLoadBackendConfig(path string) *BackendConfig + func (p *BackendConfig) Clone() *BackendConfig + type Call struct + Client BackendClient + Config *Config + Done chan *Call + Error error + type Config struct + ConfDir string + FuncMap template.FuncMap + FuncMapUpdater func(m template.FuncMap, basefn *TemplateFunc) + HookAbsKeyAdjuster func(absKey string) (realKey string) + HookOnCheckCmdDone func(trName, cmd string, err error) + HookOnReloadCmdDone func(trName, cmd string, err error) + HookOnUpdateDone func(trName string, err error) + Interval int + KeepStageFile bool + LogLevel string + Noop bool + Onetime bool + PGPPrivateKey string + Prefix string + SyncOnly bool + Watch bool + func LoadConfig(path string) (p *Config, err error) + func LoadConfigFromJsonString(s string) (p *Config, err error) + func MustLoadConfig(path string) *Config + func (p *Config) Clone() *Config + func (p *Config) GetConfigDir() string + func (p *Config) GetDefaultTemplateOutputDir() string + func (p *Config) GetTemplateDir() string + func (p *Config) Save(name string) error + func (p *Config) Valid() error + type KVPair struct + Key string + Value string + func (p KVPair) String() string + type KVStore struct + func NewKVStore() *KVStore + func (p *KVStore) Del(key string) + func (p *KVStore) Exists(key string) bool + func (p *KVStore) Get(key string) (kv KVPair, ok bool) + func (p *KVStore) GetAll(pattern string) ([]KVPair, error) + func (p *KVStore) GetAllValues(pattern string) ([]string, error) + func (p *KVStore) GetValue(key string, v ...string) (s string, ok bool) + func (p *KVStore) List(filePath string) []string + func (p *KVStore) ListDir(filePath string) []string + func (s *KVStore) Purge() + func (s *KVStore) Set(key string, value string) + type Logger interface + Assert func(condition bool, v ...interface{}) + Assertf func(condition bool, format string, v ...interface{}) + Assertln func(condition bool, v ...interface{}) + Debug func(v ...interface{}) + Debugf func(format string, v ...interface{}) + Debugln func(v ...interface{}) + Error func(v ...interface{}) + Errorf func(format string, v ...interface{}) + Errorln func(v ...interface{}) + Fatal func(v ...interface{}) + Fatalf func(format string, v ...interface{}) + Fatalln func(v ...interface{}) + GetLevel func() string + Info func(v ...interface{}) + Infof func(format string, v ...interface{}) + Infoln func(v ...interface{}) + Panic func(v ...interface{}) + Panicf func(format string, v ...interface{}) + Panicln func(v ...interface{}) + SetLevel func(new string) (old string) + Warning func(v ...interface{}) + Warningf func(format string, v ...interface{}) + Warningln func(v ...interface{}) + func GetLogger() Logger + func NewStdLogger(out io.Writer, prefix, level string, flag int) Logger + func SetLogger(new Logger) (old Logger) + type Options func(*Config) + func WithAbsKeyAdjuster(fn func(absKey string) (realKey string)) Options + func WithFuncMap(maps ...template.FuncMap) Options + func WithFuncMapUpdater(fn func(m template.FuncMap, basefn *TemplateFunc)) Options + func WithHookOnCheckCmdDone(fn func(trName, cmd string, err error)) Options + func WithHookOnReloadCmdDone(fn func(trName, cmd string, err error)) Options + func WithHookOnUpdateDone(fn func(trName string, err error)) Options + func WithInterval(interval int) Options + func WithIntervalMode() Options + func WithOnetimeMode() Options + func WithWatchMode() Options + type Processor struct + func NewProcessor() *Processor + func (p *Processor) Close() error + func (p *Processor) Go(cfg *Config, client BackendClient, opts ...Options) *Call + func (p *Processor) Run(cfg *Config, client BackendClient, opts ...Options) error + type TemplateFunc struct + FuncMap map[string]interface{} + HookKeyAdjuster func(key string) (realKey string) + PGPPrivateKey []byte + Store *KVStore + func NewTemplateFunc(store *KVStore, pgpPrivateKey []byte, ...) *TemplateFunc + func (_ TemplateFunc) Add(a, b int) int + func (_ TemplateFunc) Atoi(s string) int + func (_ TemplateFunc) Base(path string) string + func (_ TemplateFunc) Base64Decode(data string) string + func (_ TemplateFunc) Base64Encode(data string) string + func (_ TemplateFunc) Contains(s, substr string) bool + func (_ TemplateFunc) Datetime() time.Time + func (_ TemplateFunc) Dir(path string) string + func (_ TemplateFunc) Div(a, b int) int + func (_ TemplateFunc) FileExists(filepath string) bool + func (_ TemplateFunc) Getenv(key string, defaultValue ...string) string + func (_ TemplateFunc) Join(a []string, sep string) string + func (_ TemplateFunc) Json(data string) map[string]interface{} + func (_ TemplateFunc) JsonArray(data string) []interface{} + func (_ TemplateFunc) LookupIP(data string) []string + func (_ TemplateFunc) LookupIPV4(data string) []string + func (_ TemplateFunc) LookupIPV6(data string) []string + func (_ TemplateFunc) LookupSRV(service, proto, name string) []*net.SRV + func (_ TemplateFunc) Map(values ...interface{}) map[string]interface{} + func (_ TemplateFunc) Mod(a, b int) int + func (_ TemplateFunc) Mul(a, b int) int + func (_ TemplateFunc) ParseBool(s string) bool + func (_ TemplateFunc) Replace(s, old, new string, n int) string + func (_ TemplateFunc) Reverse(values interface{}) interface{} + func (_ TemplateFunc) Seq(first, last int) []int + func (_ TemplateFunc) SortByLength(values []string) []string + func (_ TemplateFunc) SortKVByLength(values []KVPair) []KVPair + func (_ TemplateFunc) Split(s, sep string) []string + func (_ TemplateFunc) Sub(a, b int) int + func (_ TemplateFunc) ToLower(s string) string + func (_ TemplateFunc) ToUpper(s string) string + func (_ TemplateFunc) TrimSuffix(s, suffix string) string + func (p TemplateFunc) Cget(key string) KVPair + func (p TemplateFunc) Cgets(pattern string) []KVPair + func (p TemplateFunc) Cgetv(key string) string + func (p TemplateFunc) Cgetvs(pattern string) []string + func (p TemplateFunc) Exists(key string) bool + func (p TemplateFunc) Get(key string) KVPair + func (p TemplateFunc) Gets(pattern string) []KVPair + func (p TemplateFunc) Getv(key string, v ...string) string + func (p TemplateFunc) Getvs(pattern string) []string + func (p TemplateFunc) Ls(filepath string) []string + func (p TemplateFunc) Lsdir(filepath string) []string + type TemplateResource struct + CheckCmd string + Dest string + FileMode os.FileMode + Gid int + Keys []string + Mode string + PGPPrivateKey []byte + Prefix string + ReloadCmd string + Src string + Uid int + func ListTemplateResource(confdir string) ([]*TemplateResource, []string, error) + func LoadTemplateResourceFile(confdir, name string) (*TemplateResource, error) + func (p *TemplateResource) SaveFile(path string) error + func (p *TemplateResource) TomlString() string + type TemplateResourceProcessor struct + func MakeAllTemplateResourceProcessor(config *Config, client BackendClient) ([]*TemplateResourceProcessor, error) + func NewTemplateResourceProcessor(path string, config *Config, client BackendClient, res *TemplateResource) *TemplateResourceProcessor + func (p *TemplateResourceProcessor) Process(call *Call) (err error) + type TomlBackend struct + TOMLFile string + func NewTomlBackendClient(cfg *BackendConfig) *TomlBackend + func (_ *TomlBackend) Close() error + func (_ *TomlBackend) Type() string + func (_ *TomlBackend) WatchEnabled() bool + func (_ *TomlBackend) WatchPrefix(prefix string, keys []string, waitIndex uint64, stopChan chan bool) (uint64, error) + func (p *TomlBackend) GetValues(keys []string) (m map[string]string, err error)