Documentation
¶
Overview ¶
Package config provides configured values for all parts of the application.
Configuration values are read from the file "config.json". This file is search in the directory of the running program, and recursively in its parent directories.
Index ¶
- Variables
- func FindFileInParent(filename string, maxdepth int) (path string, err error)
- func ReadConfigFile(logger_ slog.Leveled, configFileName_ string, maxDepth_ int) bool
- func Value(key string, ret interface{}) (err error)
- func ValueOr(key string, ret interface{}, byDefault interface{}) (err error)
- type KeyNotFound
Constants ¶
This section is empty.
Variables ¶
var BaseDir string
BaseDir is the path in which the configuration file has been found.
Functions ¶
func FindFileInParent ¶
FindFileInParent search a file with the given filename. The search starts in the current directory then explores recursively the parent directories. The search fails after maxdepth changes of directory, i.e., when maxdepth is zero the file is search only in the current directory.
func ReadConfigFile ¶
ReadConfigFile reads and stores the given configuration file. This method must be called once before Value is called. When called multiple times, only the values from the last read configuration file are available.
Types ¶
type KeyNotFound ¶
type KeyNotFound string
Error returned when the key is not found in the configuration.
func (KeyNotFound) Error ¶
func (self KeyNotFound) Error() string