20 lines
309 B
Go
20 lines
309 B
Go
package config
|
|
|
|
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
|
|
}
|