add apps from config
This commit is contained in:
@@ -23,6 +23,12 @@ type Config struct {
|
|||||||
Communities []string
|
Communities []string
|
||||||
Origin string
|
Origin string
|
||||||
}
|
}
|
||||||
|
Apps []struct {
|
||||||
|
Name string
|
||||||
|
Vip string
|
||||||
|
Monitors []string
|
||||||
|
Nats []string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfig(file string) *Config {
|
func GetConfig(file string) *Config {
|
||||||
|
|||||||
@@ -95,6 +95,15 @@ func NewMonitor(config *c.Config) *MonitorMgr {
|
|||||||
config.Agent.CleanupTimer = defaultCleanupTimer
|
config.Agent.CleanupTimer = defaultCleanupTimer
|
||||||
}
|
}
|
||||||
mon.config = config
|
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
|
return mon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user