(configPath, authDir string, reload func(*config.Config))
| 9 | ) |
| 10 | |
| 11 | func defaultWatcherFactory(configPath, authDir string, reload func(*config.Config)) (*WatcherWrapper, error) { |
| 12 | w, err := watcher.NewWatcher(configPath, authDir, reload) |
| 13 | if err != nil { |
| 14 | return nil, err |
| 15 | } |
| 16 | |
| 17 | return &WatcherWrapper{ |
| 18 | start: func(ctx context.Context) error { |
| 19 | return w.Start(ctx) |
| 20 | }, |
| 21 | stop: func() error { |
| 22 | return w.Stop() |
| 23 | }, |
| 24 | setConfig: func(cfg *config.Config) { |
| 25 | w.SetConfig(cfg) |
| 26 | }, |
| 27 | snapshotAuths: func() []*coreauth.Auth { return w.SnapshotCoreAuths() }, |
| 28 | setUpdateQueue: func(queue chan<- watcher.AuthUpdate) { |
| 29 | w.SetAuthUpdateQueue(queue) |
| 30 | }, |
| 31 | dispatchRuntimeUpdate: func(update watcher.AuthUpdate) bool { |
| 32 | return w.DispatchRuntimeAuthUpdate(update) |
| 33 | }, |
| 34 | dispatchPersistedAuth: func(update watcher.AuthUpdate) bool { |
| 35 | return w.DispatchPersistedAuthUpdate(update) |
| 36 | }, |
| 37 | setPluginAuthParser: func(parser PluginAuthParser) { |
| 38 | w.SetPluginAuthParser(parser) |
| 39 | }, |
| 40 | reloadConfigIfChanged: func() { |
| 41 | w.ReloadConfigIfChanged() |
| 42 | }, |
| 43 | }, nil |
| 44 | } |
nothing calls this directly
no test coverage detected