Fix config parsing

This commit is contained in:
Luca 2022-07-24 04:42:44 +02:00
parent eb4fa0b799
commit 72b511a120
1 changed files with 3 additions and 1 deletions

View File

@ -29,12 +29,14 @@ type ServerConfig struct {
ListenAddress string `json:"listen_address"` ListenAddress string `json:"listen_address"`
} }
func ParseFromFile(path string) (config *Config, err error) { func ParseFromFile(path string) (*Config, error) {
data, err := os.ReadFile(path) data, err := os.ReadFile(path)
if err != nil { if err != nil {
return nil, err return nil, err
} }
config := &Config{}
err = json.Unmarshal(data, config) err = json.Unmarshal(data, config)
if err != nil { if err != nil {
return nil, err return nil, err