Fix DB not closing on exit

This commit is contained in:
2024-08-10 00:43:35 +02:00
parent e86aadac02
commit 35ca7620f4

View File

@@ -40,6 +40,7 @@ var (
)
// TODO: Embed food.ddl and create DB if no exists
// TODO: Add averages to graphs (ie. R2) https://stackoverflow.com/questions/60622195/how-to-draw-a-linear-regression-line-in-chart-js
func main() {
dbpath := flag.String("db", "food.db", "Path to the database file")
flag.Parse()
@@ -50,6 +51,7 @@ func main() {
Error.Printf("%++v", err)
os.Exit(1)
}
defer db.Close()
settingsService = &SettingsService{db: &db}
err = settingsService.LoadSettings()