mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
fix: Return an error if the user home directory cannot be determined for the fallback log path.
This commit is contained in:
@@ -99,9 +99,11 @@ func ConfigureLogOutput(loggingToFile bool, logsMaxTotalSizeMB int) error {
|
|||||||
// When logging to file is enabled but WRITABLE_PATH is not set,
|
// When logging to file is enabled but WRITABLE_PATH is not set,
|
||||||
// use a default writable location to avoid errors on read-only filesystems
|
// use a default writable location to avoid errors on read-only filesystems
|
||||||
// (e.g., Homebrew installations on macOS).
|
// (e.g., Homebrew installations on macOS).
|
||||||
if home, err := os.UserHomeDir(); err == nil {
|
home, err := os.UserHomeDir()
|
||||||
logDir = filepath.Join(home, ".cliproxyapi", "logs")
|
if err != nil {
|
||||||
|
return fmt.Errorf("logging: failed to determine user home directory for fallback log path: %w", err)
|
||||||
}
|
}
|
||||||
|
logDir = filepath.Join(home, ".cliproxyapi", "logs")
|
||||||
}
|
}
|
||||||
|
|
||||||
protectedPath := ""
|
protectedPath := ""
|
||||||
|
|||||||
Reference in New Issue
Block a user