package main import ( _ "embed" "encoding/json" "log" "os" ) //go:embed default_config.json var defaultConfig string type CeresConfig struct { HttpAddress string `json:"http_address"` StorageFilePath string `json:"storage_file_path"` } var config CeresConfig func init() { err := json.Unmarshal([]byte(defaultConfig), &config) if err != nil { log.Fatal(err) } } func (c *CeresConfig) Read(path string) { data, err := os.ReadFile(path) if err != nil { log.Fatal(err) } err = json.Unmarshal(data, &c) if err != nil { log.Fatal(err) } }