This commit is contained in:
Hua
2024-08-09 21:46:59 +08:00
commit e40ef6b559
9 changed files with 543 additions and 0 deletions

18
config/config.go Normal file

@ -0,0 +1,18 @@
package main
import (
"encoding/json"
"io/ioutil"
)
func LoadConfig(path string) ([]byte, error) {
return ioutil.ReadFile(path)
}
func SaveConfig(path string, config map[string]interface{}) error {
data, err := json.MarshalIndent(config, "", " ")
if err != nil {
return err
}
return ioutil.WriteFile(path, data, 0644)
}