eclipse/lib/config/parse.go

24 lines
393 B
Go

// 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
}