From 80002ea19524144efd27812d0e34876d2d7ced63 Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 13 Jan 2026 10:31:39 +0200 Subject: [PATCH] Prioritize global config over local .env file Check ~/.config/prompt/config and ~/.prompt.env before .env in current directory. This prevents issues when running prompt in project directories that have their own .env files for other purposes. Co-Authored-By: Claude Sonnet 4.5 --- README.md | 6 +++--- main.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 60f9d06..89dcc16 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ go install ## Configuration The tool looks for configuration files in the following order: -1. `.env` in the current directory (for project-specific configs) -2. `~/.config/prompt/config` (XDG standard location) -3. `~/.prompt.env` (home directory) +1. `~/.config/prompt/config` (XDG standard location) +2. `~/.prompt.env` (home directory) +3. `.env` in the current directory (for project-specific overrides) ### Setup your config: diff --git a/main.go b/main.go index 5f62fad..a201354 100644 --- a/main.go +++ b/main.go @@ -66,9 +66,9 @@ func loadConfig() error { } configPaths := []string{ - ".env", // Current directory filepath.Join(homeDir, ".config", "prompt", "config"), // XDG standard filepath.Join(homeDir, ".prompt.env"), // Home directory + ".env", // Current directory (for project-specific overrides) } var lastErr error