From 3b75d945c43917a6d461a2a5f04a998978c73212 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Fri, 10 Apr 2026 23:38:08 +0200 Subject: [PATCH] don't crash when config is empty Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- back/config/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/back/config/config.go b/back/config/config.go index 903d5f3..bdd8e77 100644 --- a/back/config/config.go +++ b/back/config/config.go @@ -2,6 +2,7 @@ package config import ( "fmt" + "io" "log" "os" @@ -86,6 +87,10 @@ func Load(path string) (*Config, error) { dec := yaml.NewDecoder(f) dec.KnownFields(true) if err := dec.Decode(&cfg); err != nil { + if err == io.EOF { + log.Printf("config: %q is empty, starting with empty config", path) + return Default(), nil + } return nil, fmt.Errorf("config: decode: %w", err) } return &cfg, nil