From 62af851b2cc61d75b585db3dd6e6e2a39c764b69 Mon Sep 17 00:00:00 2001 From: jamesread Date: Fri, 24 Oct 2025 22:38:26 +0100 Subject: [PATCH] fix: Error getting absolute path for config.yaml --- service/main.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/service/main.go b/service/main.go index 23c9f41..0ba3f72 100644 --- a/service/main.go +++ b/service/main.go @@ -109,6 +109,19 @@ func getBasePort() int { return basePort } +func getConfigPath(directory string) string { + joinedPath := filepath.Join(directory, "config.yaml") + + configPath, err := filepath.Abs(joinedPath) + + if err != nil { + log.WithError(err).Warnf("Error getting absolute path for %s", joinedPath) + return joinedPath + } + + return configPath +} + func initConfig(configDir string) { k := koanf.New(".") k.Load(env.Provider(".", ".", nil), nil) @@ -130,7 +143,8 @@ func initConfig(configDir string) { var firstConfigPath string for _, directory := range directories { - configPath, _ := filepath.Abs(filepath.Join(directory, "config.yaml")) + configPath := getConfigPath(directory) + log.Debugf("Checking config path: %s", configPath) if _, err := os.Stat(configPath); err != nil {