pomerium

import (
"github.com/rjeczalik/notify"
)


func (watcher *Watcher) Add(filePath string) {


ch := make(chan notify.EventInfo, 1)
	go func() {
		for evt := range ch {
			log.Info(ctx).Str("event", evt.Event().String()).Msg("filemgr: detected file change")
			watcher.Signal.Broadcast(ctx)
		}
	}()
	err := notify.Watch(filePath, ch, notify.All)
	if err != nil {
		log.Error(ctx).Err(err).Msg("filemgr: error watching file path")
		notify.Stop(ch)
		close(ch)
		return
	}
	log.Debug(ctx).Msg("filemgr: watching file for changes")



}