(ctx context.Context)
| 46 | } |
| 47 | |
| 48 | func (w *Watcher) processEvents(ctx context.Context) { |
| 49 | for { |
| 50 | select { |
| 51 | case <-ctx.Done(): |
| 52 | return |
| 53 | case event, ok := <-w.watcher.Events: |
| 54 | if !ok { |
| 55 | return |
| 56 | } |
| 57 | w.handleEvent(event) |
| 58 | case errWatch, ok := <-w.watcher.Errors: |
| 59 | if !ok { |
| 60 | return |
| 61 | } |
| 62 | log.Errorf("file watcher error: %v", errWatch) |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func (w *Watcher) handleEvent(event fsnotify.Event) { |
| 68 | // Filter only relevant events: config file or auth-dir JSON files. |