# README
File Loader
File loader loads config from files
Usage
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()
# Functions
New creates a new Loader fromt the Config cfg.
NewFileLoader returns a new file loader with the given name n, the parser p and the file paths filePaths.
# Variables
DefaultRate is the default polling rate to check files.
ErrNoFiles is the error thrown when trying to create a file loader with no files in config.
ErrNoParser is the error thrown when trying to create a file loader with no parser.