filewatcher

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WatchFiles

func WatchFiles(shutdown context.Context, reporter WatcherReporter, paths ...string) config.Option

WatchFiles adds a file watcher to the config extensions. When activated it starts a go routine to check for file changes in the background. If a given file in the paths changes, the config will be instructed to reload. Use the shutdown context to signal when the app is shutting down, to orderly stop the go routine. Use the reporter interface to receive any warnings/errors encountered in the background go routine. This interface also gets notified when a watched path has changed. If the interface is nil, warnings/errors and file changes will be silently discarded.

Types

type WatcherReporter

type WatcherReporter interface {
	config.Reporter
	FileChanged(path string)
}

WatcherReporter represents the interface to report back warnings, errors and changed files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL