Skip to content

Commit 3af75e6

Browse files
committed
feat: Enable global config from home directory
1 parent 3a23122 commit 3af75e6

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

cmd/main.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,21 @@ func main() {
7979
targetDir = args[0]
8080
}
8181

82-
configData, err := os.ReadFile("lx-config.yaml")
82+
configPath := "lx-config.yaml"
83+
if _, err := os.Stat(configPath); os.IsNotExist(err) {
84+
home, err := os.UserHomeDir()
85+
if err == nil {
86+
configPath = filepath.Join(home, "lx-config.yaml")
87+
}
88+
}
89+
90+
configData, err := os.ReadFile(configPath)
8391
if err != nil {
84-
log.Fatalf("lx-config.yaml 확인 필요: %v", err)
92+
log.Fatalf("설정 파일을 찾을 수 없습니다. (./lx-config.yaml 또는 ~/lx-config.yaml 확인 필요): %v", err)
8593
}
94+
95+
fmt.Printf("설정 로드 완료: %s\n", configPath)
96+
8697
var config Config
8798
yaml.Unmarshal(configData, &config)
8899

0 commit comments

Comments
 (0)