StoreBackEnd/pkg/config/JsonConfigReader.go

22 lines
321 B
Go
Raw Normal View History

package config
import (
"encoding/json"
"io/ioutil"
)
func Read(filePath string) (*AppConfig, error) {
config := AppConfig{}
file, err := ioutil.ReadFile(filePath)
if err != nil {
return nil, err
}
errJson := json.Unmarshal(file, &config)
if errJson != nil {
return nil, errJson
}
return &config, nil
}