crip/config/config.go

20 lines
309 B
Go
Raw Permalink Normal View History

2024-04-16 12:55:08 +01:00
package config
2024-04-16 13:12:48 +01:00
import (
"encoding/json"
"log"
"os"
)
func Read(fname string) *Config {
var config Config
cb, err := os.ReadFile(fname)
if err != nil {
log.Fatal("config file:", err)
}
if err := json.Unmarshal(cb, &config); err != nil {
log.Fatal("config parse error:", err)
}
return &config
}