From f478f7545c158f8a536adc0b38282dd6b60ec7ee Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Wed, 15 Apr 2026 11:16:16 +0200 Subject: [PATCH] ensureEnv: set OLLIE_* defaults at startup Ensure all OLLIE_* path env vars (OLLIE, OLLIE_TOOLS_PATH, OLLIE_SKILLS_PATH, OLLIE_PLAN_PATH, OLLIE_MEMORY_PATH) are set to their default values via os.Setenv before the server or any session is created. This guarantees they are visible to tool subprocesses without requiring explicit external configuration. --- main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/main.go b/main.go index d41f7d8..eb25049 100644 --- a/main.go +++ b/main.go @@ -104,7 +104,25 @@ func stopServer(sockPath, pidPath string) { fmt.Println("olliesrv stopped") } +func ensureEnv() { + home, _ := os.UserHomeDir() + defaults := map[string]string{ + "OLLIE": filepath.Join(home, "mnt", "ollie"), + "OLLIE_TOOLS_PATH": filepath.Join(home, ".config", "ollie", "tools"), + "OLLIE_SKILLS_PATH": filepath.Join(home, ".config", "ollie", "skills"), + "OLLIE_PLAN_PATH": filepath.Join(home, ".config", "ollie", "planning"), + "OLLIE_MEMORY_PATH": filepath.Join(home, ".config", "ollie", "memory"), + } + for k, v := range defaults { + if os.Getenv(k) == "" { + os.Setenv(k, v) //nolint:errcheck + } + } +} + func runServer(sockPath, pidPath string) { + ensureEnv() + // Remove stale socket if _, err := os.Stat(sockPath); err == nil { os.Remove(sockPath) //nolint:errcheck