Skip to content

Commit

Permalink
Fix: Repair the logic for obtaining the configuration file path. (#60)
Browse files Browse the repository at this point in the history
Fixed the logic for obtaining the configuration file path to ensure that config.json is used as the default when no command line arguments are provided.
  • Loading branch information
aliensb authored Sep 25, 2024
1 parent 9ef70da commit 6d9ba95
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ type config struct {
}

func readConfig() *config {
content, err := os.ReadFile("config.json")
var configPath string
if len(os.Args) > 1 {
configPath = os.Args[1]
} else {
configPath = "config.json"
}
content, err := os.ReadFile(configPath)
if nil != err {
log.Fatal(err)
}
Expand Down

0 comments on commit 6d9ba95

Please sign in to comment.