cmd/chihaya: s/chihayaCfg/cfg
This commit is contained in:
parent
23e9719073
commit
7b1e7e8c99
1 changed files with 9 additions and 9 deletions
|
@ -46,35 +46,35 @@ func (r *Run) Start(ps storage.PeerStore) error {
|
||||||
return errors.New("failed to read config: " + err.Error())
|
return errors.New("failed to read config: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
chihayaCfg := configFile.Chihaya
|
cfg := configFile.Chihaya
|
||||||
preHooks, postHooks, err := chihayaCfg.CreateHooks()
|
preHooks, postHooks, err := cfg.CreateHooks()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to validate hook config: " + err.Error())
|
return errors.New("failed to validate hook config: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
r.sg = stop.NewGroup()
|
r.sg = stop.NewGroup()
|
||||||
r.sg.Add(prometheus.NewServer(chihayaCfg.PrometheusAddr))
|
r.sg.Add(prometheus.NewServer(cfg.PrometheusAddr))
|
||||||
|
|
||||||
if ps == nil {
|
if ps == nil {
|
||||||
ps, err = memory.New(chihayaCfg.Storage)
|
ps, err = memory.New(cfg.Storage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to create memory storage: " + err.Error())
|
return errors.New("failed to create memory storage: " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.peerStore = ps
|
r.peerStore = ps
|
||||||
|
|
||||||
r.logic = middleware.NewLogic(chihayaCfg.Config, r.peerStore, preHooks, postHooks)
|
r.logic = middleware.NewLogic(cfg.Config, r.peerStore, preHooks, postHooks)
|
||||||
|
|
||||||
if chihayaCfg.HTTPConfig.Addr != "" {
|
if cfg.HTTPConfig.Addr != "" {
|
||||||
httpfe, err := http.NewFrontend(r.logic, chihayaCfg.HTTPConfig)
|
httpfe, err := http.NewFrontend(r.logic, cfg.HTTPConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
r.sg.Add(httpfe)
|
r.sg.Add(httpfe)
|
||||||
}
|
}
|
||||||
|
|
||||||
if chihayaCfg.UDPConfig.Addr != "" {
|
if cfg.UDPConfig.Addr != "" {
|
||||||
udpfe, err := udp.NewFrontend(r.logic, chihayaCfg.UDPConfig)
|
udpfe, err := udp.NewFrontend(r.logic, cfg.UDPConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue