Skip to content

Commit

Permalink
Close configuration file once parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
RLado committed Jun 21, 2024
1 parent bfbfd53 commit 3c19889
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,15 @@ func main() {
if err != nil {
log.Fatalf("Error opening config file: %s", err)
}
defer file.Close()

cfg := config{}
err = json.NewDecoder(file).Decode(&cfg)
if err != nil {
log.Fatalf("Error decoding config file: %s", err)
}

file.Close()

// Enforce minimum interval of 60 seconds
if cfg.Global.Interval < 60 {
if *verbose {
Expand Down

0 comments on commit 3c19889

Please sign in to comment.