fix: Implement fallback log directory for file logging on read-only systems.
This commit is contained in:
1 parent
a38a9c0b0f
commit
6705d20194
1 file changed
+7
@@ -95,6 +95,13 @@ func ConfigureLogOutput(loggingToFile bool, logsMaxTotalSizeMB int) error {
|
||||
logDir := "logs"
|
||||
if base := util.WritablePath(); base != "" {
|
||||
logDir = filepath.Join(base, "logs")
|
||||
} else if loggingToFile {
|
||||
// When logging to file is enabled but WRITABLE_PATH is not set,
|
||||
// use a default writable location to avoid errors on read-only filesystems
|
||||
// (e.g., Homebrew installations on macOS).
|
||||
if home, err := os.UserHomeDir(); err == nil {
|
||||
logDir = filepath.Join(home, ".cliproxyapi", "logs")
|
||||
}
|
||||
}
|
||||
|
||||
protectedPath := ""
|
||||
|
||||
Reference in new issue
Block a user