add apps from config

This commit is contained in:
Mayuresh Gaitonde
2018-11-05 14:28:53 -08:00
parent b22f383ab1
commit e076c04edb
2 changed files with 15 additions and 0 deletions

View File

@@ -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
}