You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
514 B

package main
import (
"encoding/json"
"io/ioutil"
)
func loadConfig() {
var c Config
confFile, _ := ioutil.ReadFile(configFile)
err := json.Unmarshal([]byte(confFile), &c)
if err != nil {
log.LogErrorType(err)
return
}
config = c
log.LogInfo("Setup completed using config file.")
}
func saveConfig() {
defer log.PanicSafe()
file, err := json.Marshal(config)
if err != nil {
log.LogErrorType(err)
}
err = ioutil.WriteFile(configFile, file, 0600)
if err != nil {
log.LogErrorType(err)
}
}