diff --git a/config/config.go b/config/config.go index 0b4a83e..aea31a5 100644 --- a/config/config.go +++ b/config/config.go @@ -23,6 +23,12 @@ type Config struct { Communities []string Origin string } + Apps []struct { + Name string + Vip string + Monitors []string + Nats []string + } } func GetConfig(file string) *Config { diff --git a/controller/monitor.go b/controller/monitor.go index 03028ff..3969a46 100644 --- a/controller/monitor.go +++ b/controller/monitor.go @@ -95,6 +95,15 @@ func NewMonitor(config *c.Config) *MonitorMgr { config.Agent.CleanupTimer = defaultCleanupTimer } mon.config = config + // add apps defined in config + for _, a := range config.Apps { + app, err := NewApp(a.Name, a.Vip, a.Monitors, a.Nats) + if err != nil { + glog.Errorf("Failed to add configured app %s: %v", a.Name, err) + continue + } + mon.Add(app) + } return mon }