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 <noreply@anthropic.com>
This commit is contained in:
parent
b7ecba9385
commit
80002ea195
2 changed files with 4 additions and 4 deletions
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
2
main.go
2
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue