Skip to content

Commit

Permalink
add apps from config
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayuresh Gaitonde committed Nov 5, 2018
1 parent b22f383 commit e076c04
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions controller/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e076c04

Please sign in to comment.