Documentation
¶
Overview ¶
Package ldfilewatch allows the LaunchDarkly client to read feature flag data from a file that will be automatically reloaded if the file changes.
It should be used in conjunction with the github.com/launchdarkly/go-server-sdk/v7/ldfiledata package:
config := ld.Config{
DataSource: ldfiledata.DataSource().
FilePaths(filePaths).
Reloader(ldfilewatch.WatchFiles),
}
The two packages are separate so as to avoid bringing additional dependencies for users who do not need automatic reloading.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchFiles ¶
func WatchFiles(paths []string, loggers ldlog.Loggers, reload func(), closeCh <-chan struct{}) error
WatchFiles sets up a mechanism for the file data source to reload its source files whenever one of them has been modified. Use it as follows:
config := Config{
DataSource: ldfiledata.DataSource().
FilePaths(filePaths).
Reloader(ldfilewatch.WatchFiles),
}
func WatchOptionalFiles ¶ added in v7.18.0
func WatchOptionalFiles(paths []string, loggers ldlog.Loggers, reload func(), closeCh <-chan struct{}) error
WatchOptionalFiles is the same as WatchFiles, except that a configured file that does not exist is not an error. The file's directory is watched, so the file is picked up when it appears. Use this for files that are allowed to be absent, such as override files.
Types ¶
This section is empty.