mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-08 04:18:13 +02:00
check if an error is terminal during initial bootstrap loading
This commit is contained in:
parent
88664a78b0
commit
2f9ea5426a
1 changed files with 9 additions and 3 deletions
|
@ -42,7 +42,10 @@ func (svc *Source) Run(
|
||||||
svc.api = api
|
svc.api = api
|
||||||
svc.fileCachePath = fileCachePath
|
svc.fileCachePath = fileCachePath
|
||||||
|
|
||||||
svc.tryLoadInitial(ctx)
|
err := svc.tryLoadInitial(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
eg.Go(func() error { return svc.watchUpdates(ctx) })
|
eg.Go(func() error { return svc.watchUpdates(ctx) })
|
||||||
|
@ -116,13 +119,16 @@ func (svc *Source) updateAndSave(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (svc *Source) tryLoadInitial(ctx context.Context) {
|
func (svc *Source) tryLoadInitial(ctx context.Context) error {
|
||||||
err := svc.updateAndSave(ctx)
|
err := svc.updateAndSave(ctx)
|
||||||
|
if retry.IsTerminalError(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Ctx(ctx).Error().Err(err).Msg("failed to load bootstrap config")
|
log.Ctx(ctx).Error().Err(err).Msg("failed to load bootstrap config")
|
||||||
svc.tryLoadFromFile(ctx)
|
svc.tryLoadFromFile(ctx)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (svc *Source) tryLoadFromFile(ctx context.Context) {
|
func (svc *Source) tryLoadFromFile(ctx context.Context) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue