Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func New ¶
New takes a pointer to cfg.Confg and a path (file or directory) to watch and overwrite the config with the content of whatever file was written to since watching.
func Open ¶
Open is a convenience function to Open the file, Load it into a cfg.Config and watch is for reloads.
Example ¶
package main
import (
"fmt"
"log"
"catinello.eu/cfg/reload"
)
func main() {
f, err := reload.Open("example/test.cfg")
if err != nil {
log.Fatal(err)
}
defer f.Close()
// use pointer to cfg.Config
c := f.Cfg()
v, err := c.Get("main", "key")
if err != nil {
log.Fatal(err)
}
fmt.Println(v)
}
Output: value
Click to show internal directories.
Click to hide internal directories.