File loader loads config from files
Basic usage with files and json parser and a watcher
fileLoader := klfile.New(&klfile.Config{
Files: []File{
{
Path: "./config.json",
Parser: kpjson.Parser,
},
},
Watch: true,
Rate: 1 * time.Second, // Rate for the polling watching the file changes
})
Simplified syntax:
fileLoader := klfile.
NewFileLoader("config-files", kpjson.Parser, "file1.json", "file2.json").
WithWatcher()