TUN-3706: Quit if any origin service fails to start

This commit is contained in:
Adam Chalmers
2020-12-30 13:48:19 -06:00
parent 32336859f8
commit b855e33327
3 changed files with 13 additions and 5 deletions

View File

@@ -113,12 +113,18 @@ func (ing Ingress) IsEmpty() bool {
}
// StartOrigins will start any origin services managed by cloudflared, e.g. proxy servers or Hello World.
func (ing Ingress) StartOrigins(wg *sync.WaitGroup, log *zerolog.Logger, shutdownC <-chan struct{}, errC chan error) {
func (ing Ingress) StartOrigins(
wg *sync.WaitGroup,
log *zerolog.Logger,
shutdownC <-chan struct{},
errC chan error,
) error {
for _, rule := range ing.Rules {
if err := rule.Service.start(wg, log, shutdownC, errC, rule.Config); err != nil {
log.Error().Msgf("Error starting local service %s: %s", rule.Service, err)
return errors.Wrapf(err, "Error starting local service %s", rule.Service)
}
}
return nil
}
// CatchAll returns the catch-all rule (i.e. the last rule)