Skip to content

Commit

Permalink
close file after we're done
Browse files Browse the repository at this point in the history
  • Loading branch information
kayra1 committed Apr 17, 2024
1 parent 2054d08 commit 5c98279
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ func ValidateConfigFile(filePath string) (Config, error) {
if err != nil {
return config, errors.Join(validationErr, err)
}
if _, err := os.OpenFile(c.DBPath, os.O_CREATE|os.O_RDONLY, 0644); err != nil {
dbfile, err := os.OpenFile(c.DBPath, os.O_CREATE|os.O_RDONLY, 0644)
if err != nil {
return config, errors.Join(validationErr, err)
}
err = dbfile.Close()
if err != nil {
return config, errors.Join(validationErr, err)
}

config.Cert = cert
config.Key = key
config.DBPath = c.DBPath
Expand Down

0 comments on commit 5c98279

Please sign in to comment.