From 19852d0b6a3712cfd2d4478defd4e321f3914f50 Mon Sep 17 00:00:00 2001 From: konrad Date: Thu, 16 Nov 2017 13:09:30 +0100 Subject: [PATCH] Moved show sql query setting to config --- config.ini | 1 + models/config.go | 11 ++++++----- models/models.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config.ini b/config.ini index fe1f941..ac50fb4 100644 --- a/config.ini +++ b/config.ini @@ -8,6 +8,7 @@ User = root Password = jup2000 Host = 127.0.0.1 Database = library2 +ShowQueries = true ; First user to be created, on every startup the program checks if he exists, if not it creates it [User] diff --git a/models/config.go b/models/config.go index 8680aef..894b2b6 100644 --- a/models/config.go +++ b/models/config.go @@ -8,14 +8,15 @@ import ( // ConfigStruct holds the config struct type ConfigStruct struct { Database struct { - Host string - User string - Password string - Database string + Host string + User string + Password string + Database string + ShowQueries bool } JWTLoginSecret []byte - Interface string + Interface string FirstUser User `ini:"User"` } diff --git a/models/models.go b/models/models.go index ae3c94f..302c169 100644 --- a/models/models.go +++ b/models/models.go @@ -33,7 +33,7 @@ func SetEngine() (err error) { x.Sync(&Status{}) x.Sync(&Quantity{}) - x.ShowSQL(true) + x.ShowSQL(Config.Database.ShowQueries) // Check if the first user already exists, aka a user with the ID = 1. If not, insert it _, exists, err := GetUserByID(1)