Documentation
¶
Overview ¶
Package conf defines utils to simplify configuration management.
It provides functions to load and save config files.
Several formats are supported. The encoders/decoders are selected according to the extension of the paths passed to functions:
- JSON: ".json" - TOML: ".toml"
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedFileType = errors.New("unsupported config type")
ErrUnsupportedFileType is returned when the type of the config file is not supported.
Functions ¶
func LoadAndUpdateFile ¶
LoadAndUpdateFile reads the config fileat path and updates it, meaning that it adds new options, removes old ones, and update it by calling the Update method of data if it implements the interface Updater.
If no file is found at path, it is created and initialized with the default values.
An error is returned only if the config file cannot be written.
func LoadFile ¶
LoadFile reads the file at path, parses its json content and fills the struct with the content of the file.