refactor(config): replace os.ReadFile with coreio.Local.Read

Use the go-io Medium abstraction instead of os.ReadFile in Load().

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-03-16 18:30:37 +00:00
parent 353817e224
commit 6beb06686a

View file

@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
coreio "forge.lthn.ai/core/go-io"
"gopkg.in/yaml.v3"
)
@ -229,13 +230,13 @@ type BackupJob struct {
// Load reads and parses an infra.yaml file.
func Load(path string) (*Config, error) {
data, err := os.ReadFile(path)
data, err := coreio.Local.Read(path)
if err != nil {
return nil, fmt.Errorf("read infra config: %w", err)
}
var cfg Config
if err := yaml.Unmarshal(data, &cfg); err != nil {
if err := yaml.Unmarshal([]byte(data), &cfg); err != nil {
return nil, fmt.Errorf("parse infra config: %w", err)
}