refactor: extract DefaultAuthDir constant per review feedback

This commit is contained in:
lihan3238
2026-05-08 22:28:38 +08:00
parent 4071fdef84
commit 4cbe172934
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -73,9 +73,10 @@ func SetLogLevel(cfg *config.Config) {
// ResolveAuthDir normalizes the auth directory path for consistent reuse throughout the app.
// It expands a leading tilde (~) to the user's home directory and returns a cleaned path.
// If authDir is empty, it defaults to ~/.cli-proxy-api.
func ResolveAuthDir(authDir string) (string, error) {
if authDir == "" {
authDir = "~/.cli-proxy-api"
authDir = config.DefaultAuthDir
}
if strings.HasPrefix(authDir, "~") {
home, err := os.UserHomeDir()