package
0.8.3
Repository: https://github.com/lalamove/konfig.git
Documentation: pkg.go.dev

# 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.

# Structs

Config is the config for the file loader.
File is a file to load from.
Loader is the structure representring a file loader.