eclipse/lib/config/parse.go

24 lines
393 B
Go
Raw Normal View History

2024-01-17 21:11:23 +00:00
// Copyright (C) 2024 Umorpha Systems
// SPDX-License-Identifier: AGPL-3.0-or-later
package config
import (
"os"
"sigs.k8s.io/yaml"
)
func Load(filename string) (Config, error) {
cfgBytes, err := os.ReadFile(filename)
if err != nil {
return Config{}, err
}
var cfg Config
if err := yaml.UnmarshalStrict(cfgBytes, &cfg); err != nil {
return Config{}, err
}
return cfg, nil
}