Compare commits

...

2 commits

2 changed files with 8 additions and 2 deletions

View file

@ -9,8 +9,8 @@ import (
argonFan "git.sungo.io/sungo/argon/fan"
"git.kemonine.info/PiFrame/utils"
"git.kemonine.info/PiFrame/config"
"git.kemonine.info/PiFrame/utils"
)
const (
@ -22,6 +22,12 @@ func main() {
// Load the config file
pfConfig, _ := config.LoadConfig()
// For some reason the map isn't populated 'right away' and/or doesn't always come in via koanf
// Work around by re-loading the config as necessary to get valid values
for pfConfig.Float64Map(config.CONFIG_KEY_FAN_SPEEDS)[config.CONFIG_MAP_KEY_FAN_SPEED_100] == 0 {
pfConfig, _ = config.LoadConfig()
}
// Get the various fan related config options as local variables
speedMap := pfConfig.Float64Map(config.CONFIG_KEY_FAN_SPEEDS)
POLL_INTERVAL := pfConfig.String(config.CONFIG_KEY_FAN_POLL_INTERVAL)

View file

@ -31,7 +31,7 @@ func LoadConfig() (*koanf.Koanf, *kfile.File) {
configFileProvider := kfile.Provider(CONFIG_FILE_PATH)
_, err := os.Stat(CONFIG_FILE_PATH)
if os.IsNotExist(err) {
//log.Printf("%s does not exist, USING DEFAULTS", ui.CONFIG_FILE_PATH)
//log.Printf("%s does not exist, USING DEFAULTS", CONFIG_FILE_PATH)
} else {
if errConfigFile := pfConfig.Load(configFileProvider, toml.Parser()); errConfigFile != nil {
log.Fatalf("Error loading config : %s", err)