papero/config/parse.go

22 lines
426 B
Go
Raw Normal View History

2021-01-09 17:06:13 +01:00
package config
import (
"errors"
"log"
)
var ErrFailedToParseConfig = errors.New("unable to cast into usable configuration")
func Parse(filePath string) (*MemConfig, error) {
fileConfig, err := parseFile(filePath)
if err != nil {
return nil, err
}
memConfig, castingErrs := parseConfig(fileConfig)
if !castingErrs.Check() {
log.Print(castingErrs)
return nil, ErrFailedToParseConfig
}
return memConfig, nil
}