Skip to content

Commit c96e24f

Browse files
Copilotm7medVision
andcommitted
Add support for ~/.config/.lazycommit.yaml configuration files
Co-authored-by: m7medVision <[email protected]>
1 parent 23c53bb commit c96e24f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ lazycommit commit -a
5151

5252
## Configuration
5353

54-
Create a `.lazycommit.yaml` file in your home directory or project root:
54+
Create a `.lazycommit.yaml` file in one of these locations (checked in order):
55+
- Current directory (`./.lazycommit.yaml`)
56+
- Home directory (`~/.lazycommit.yaml`)
57+
- Config directory (`~/.config/.lazycommit.yaml`)
5558

5659
```yaml
5760
active_provider: openai

internal/config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ func InitConfig() {
3434
fmt.Println("Error getting home directory:", err)
3535
os.Exit(1)
3636
}
37-
viper.AddConfigPath(home)
38-
viper.AddConfigPath(".") // Also look in the current directory
37+
viper.AddConfigPath(".") // Look in the current directory first
38+
viper.AddConfigPath(home) // Then home directory
39+
viper.AddConfigPath(getConfigDir()) // Finally ~/.config directory
3940

4041
// Set defaults based on available credentials
4142
if token, err := LoadGitHubToken(); err == nil && token != "" {

0 commit comments

Comments
 (0)