Versions in this module Expand all Collapse all v1 v1.3.0 Sep 6, 2018 Changes in this version + var ConfigCache map[string]map[string][]byte + var ConfigSchedulerInterval = 300 + var ValidSchemes = []string + func CacheConfigs(manager string, files []string) error + func CompareAndCopy(source string, dest string, m string) bool + func CopyFile(src string, dst string) error + func GetConfigManager(entry string, bc *ConfigSettings) error + func GetManagerStatus(statusFile string, manager string) bool + func IsValidScheme(s string) bool + func ParseConfig(config []byte) error + func ParseMustacheSubs(pairs []string) (map[string]string, error) + func RenderConfigMustache(f *os.File, subs map[string]string) error + func RestoreCachedConfigs(manager string, files []string, cleanFiles bool) error + func SetManagerStatus(statusFile string, manager string, state bool) error + func ValidateConfig(opts *ValidateOpts) error + func ValidateMustacheSubs(Subs map[string]string) bool + func WriteManagerStatusFile(statusFile string, status Status) error + type ButlerConfig struct + Client *ConfigClient + Config *ConfigSettings + Endpoints []string + FirstRun bool + HttpAuthToken string + HttpAuthType string + HttpAuthUser string + Interval int + LogLevel log.Level + PrevCMSchedulerInterval int + RawConfig []byte + Retries int + RetryWaitMax int + RetryWaitMin int + S3Bucket string + S3Region string + Scheduler *gocron.Scheduler + Timeout int + Url *url.URL + func NewButlerConfig() *ButlerConfig + func (bc *ButlerConfig) CheckPaths() error + func (bc *ButlerConfig) GetCMInterval() int + func (bc *ButlerConfig) GetCMPrevInterval() int + func (bc *ButlerConfig) GetInterval() int + func (bc *ButlerConfig) GetLogLevel() log.Level + func (bc *ButlerConfig) GetManager(m string) *Manager + func (bc *ButlerConfig) GetManagers() map[string]*Manager + func (bc *ButlerConfig) GetPath() string + func (bc *ButlerConfig) GetStatusFile() string + func (bc *ButlerConfig) Handler() error + func (bc *ButlerConfig) Init() error + func (bc *ButlerConfig) RunCMHandler() error + func (bc *ButlerConfig) SetCMInterval(i int) error + func (bc *ButlerConfig) SetCMPrevInterval(i int) error + func (bc *ButlerConfig) SetEndpoints(e []string) error + func (bc *ButlerConfig) SetHttpAuthToken(t string) error + func (bc *ButlerConfig) SetHttpAuthType(t string) error + func (bc *ButlerConfig) SetHttpAuthUser(t string) error + func (bc *ButlerConfig) SetInterval(t int) error + func (bc *ButlerConfig) SetLogLevel(level log.Level) + func (bc *ButlerConfig) SetPath(p string) error + func (bc *ButlerConfig) SetRegion(r string) error + func (bc *ButlerConfig) SetRegionAndBucket(r string, b string) error + func (bc *ButlerConfig) SetRetries(t int) error + func (bc *ButlerConfig) SetRetryWaitMax(t int) error + func (bc *ButlerConfig) SetRetryWaitMin(t int) error + func (bc *ButlerConfig) SetScheduler(s *gocron.Scheduler) error + func (bc *ButlerConfig) SetScheme(s string) error + func (bc *ButlerConfig) SetTimeout(t int) error + type ChanEvent interface + CanCopyFiles func() bool + CleanTmpFiles func() error + CopyAdditionalConfigFiles func(string) bool + CopyPrimaryConfigFiles func(map[string]*ManagerOpts) bool + GetTmpFileMap func() []TmpFile + SetSuccess func(string, string, error) error + SetTmpFile func(string, string, string) error + type ConfigChanEvent struct + ConfigFile *string + HasChanged bool + Manager string + Repo map[string]*RepoFileEvent + TmpFile *os.File + func NewConfigChanEvent() *ConfigChanEvent + func (c *ConfigChanEvent) CanCopyFiles() bool + func (c *ConfigChanEvent) CleanTmpFiles() error + func (c *ConfigChanEvent) CopyAdditionalConfigFiles(destDir string) bool + func (c *ConfigChanEvent) CopyPrimaryConfigFiles(opts map[string]*ManagerOpts) bool + func (c *ConfigChanEvent) GetTmpFileMap() []TmpFile + func (c *ConfigChanEvent) SetFailure(repo string, file string, err error) error + func (c *ConfigChanEvent) SetSuccess(repo string, file string, err error) error + func (c *ConfigChanEvent) SetTmpFile(repo string, file string, tmpfile string) error + type ConfigClient struct + HttpClient *retryablehttp.Client + Method methods.Method + Scheme string + func NewConfigClient(scheme string) (*ConfigClient, error) + func (c *ConfigClient) Get(val *url.URL) (*methods.Response, error) + func (c *ConfigClient) SetRetryMax(val int) + func (c *ConfigClient) SetRetryWaitMax(val int) + func (c *ConfigClient) SetRetryWaitMin(val int) + func (c *ConfigClient) SetTimeout(val int) + type ConfigFileMap struct + Success bool + TmpFile string + type ConfigGlobals struct + CfgEnableHttpLog string + CfgExitOnFailure string + CfgHttpPort string + CfgHttpProto string + CfgHttpTlsCert string + CfgHttpTlsKey string + CfgSchedulerInterval string + CfgStatusFile string + EnableHttpLog bool + ExitOnFailure bool + HttpPort int + HttpProto string + HttpTlsCert string + HttpTlsKey string + Managers []string + SchedulerInterval int + StatusFile string + type ConfigSettings struct + Globals ConfigGlobals + Managers map[string]*Manager + func NewConfigSettings() *ConfigSettings + func (b *ConfigSettings) GetAllConfigLocalPaths(mgr string) []string + func (c *ConfigSettings) ParseConfig(config []byte) error + type Manager struct + CachePath string + CfgCleanFiles string + CfgEnableCache string + CfgManagerTimeoutOk string + CleanFiles bool + DestPath string + EnableCache bool + GoodCache bool + LastRun time.Time + ManagerOpts map[string]*ManagerOpts + ManagerTimeoutOk bool + MustacheSubs map[string]string + MustacheSubsArray []string + Name string + PrimaryConfigName string + ReloadManager bool + Reloader reloaders.Reloader + Repos []string + func (bm *Manager) DownloadAdditionalConfigFiles(c chan ChanEvent) error + func (bm *Manager) DownloadPrimaryConfigFiles(c chan ChanEvent) error + func (bm *Manager) GetAllLocalPaths() []string + func (bm *Manager) PathCleanup(path string, f os.FileInfo, err error) error + func (bm *Manager) Reload() error + type ManagerOpts struct + AdditionalConfig []string + AdditionalConfigsFullLocalPaths []string + AdditionalConfigsFullUrls []string + ContentType string + Method string + Opts methods.Method + PrimaryConfig []string + PrimaryConfigsFullLocalPaths []string + PrimaryConfigsFullUrls []string + Repo string + RepoPath string + func GetManagerOpts(entry string, bc *ConfigSettings) (*ManagerOpts, error) + func (bmo *ManagerOpts) AppendAdditionalConfigFile(c string) error + func (bmo *ManagerOpts) AppendAdditionalConfigUrl(c string) error + func (bmo *ManagerOpts) AppendPrimaryConfigFile(c string) error + func (bmo *ManagerOpts) AppendPrimaryConfigUrl(c string) error + func (bmo *ManagerOpts) DownloadConfigFile(file string) *os.File + func (bmo *ManagerOpts) GetAdditionalConfigUrls() []string + func (bmo *ManagerOpts) GetAdditionalLocalConfigFiles() []string + func (bmo *ManagerOpts) GetAdditionalRemoteConfigFiles() []string + func (bmo *ManagerOpts) GetPrimaryConfigUrls() []string + func (bmo *ManagerOpts) GetPrimaryLocalConfigFiles() []string + func (bmo *ManagerOpts) GetPrimaryRemoteConfigFiles() []string + func (bmo *ManagerOpts) SetParentManager(c string) error + type RepoFileEvent struct + Error map[string]error + Success map[string]bool + TmpFile map[string]string + func (r *RepoFileEvent) SetFailure(file string, err error) error + func (r *RepoFileEvent) SetSuccess(file string, err error) error + func (r *RepoFileEvent) SetTmpFile(file string, tmpfile string) error + type Status struct + Manager map[string]bool + func ReadManagerStatusFile(statusFile string) (*Status, error) + type TmpFile struct + File string + Name string + type ValidateOpts struct + ContentType string + Data interface{} + FileName string + Manager string + func NewValidateOpts() *ValidateOpts + func (o *ValidateOpts) WithContentType(t string) *ValidateOpts + func (o *ValidateOpts) WithData(d interface{}) *ValidateOpts + func (o *ValidateOpts) WithFileName(f string) *ValidateOpts + func (o *ValidateOpts) WithManager(m string) *ValidateOpts