From 7b77923ceb763a8e426afec8d359c3a9feb26ec9 Mon Sep 17 00:00:00 2001 From: Hamid FzM Date: Thu, 16 Aug 2018 20:02:51 +0430 Subject: [PATCH] Get database name from config --- models/database.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/database.go b/models/database.go index 472c9fb..a01189f 100644 --- a/models/database.go +++ b/models/database.go @@ -10,7 +10,7 @@ var DB *gorm.DB var tables = []interface{}{&User{}, &Time{}} func SetupDatabase() { - if db, err := gorm.Open("sqlite3", "develop.db"); err != nil { + if db, err := gorm.Open("sqlite3", helpers.Config.DBName); err != nil { panic("failed to connect database") } else { DB = db @@ -21,7 +21,7 @@ func SetupDatabase() { } func SetupTestDatabase() { - if db, err := gorm.Open("sqlite3", "../test.db"); err != nil { + if db, err := gorm.Open("sqlite3", "../data/test.db"); err != nil { panic("failed to connect database") } else { DB = db