Abort startup on a config file pixa cannot read (closes #176) #181

Merged
clawbot merged 4 commits from issue-176-unreadable-config into next 2026-10-04 18:24:44 +02:00
Showing only changes of commit c29b68e232 - Show all commits
+6 -3
View File
@@ -15,6 +15,7 @@ import (
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"syscall"
"time" "time"
"git.eeqj.de/sneak/smartconfig" "git.eeqj.de/sneak/smartconfig"
@@ -779,10 +780,12 @@ func loadConfigFile(log *slog.Logger, appName string) (*smartconfig.Config, erro
for _, path := range configPaths { for _, path := range configPaths {
cleanPath := filepath.Clean(path) cleanPath := filepath.Clean(path)
// Only a config file that does not exist is skipped. One that // Only a config file that does not exist is skipped, including
// cannot be read or does not parse is a fatal startup error. // one whose path runs through a file, such as under a HOME of
// /dev/null. One that cannot be read or does not parse is a
// fatal startup error.
_, statErr := os.Stat(cleanPath) _, statErr := os.Stat(cleanPath)
if errors.Is(statErr, fs.ErrNotExist) { if errors.Is(statErr, fs.ErrNotExist) || errors.Is(statErr, syscall.ENOTDIR) {
continue continue
} }