Skip to content

Commit

Permalink
Get database name from config
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidfzm committed Aug 16, 2018
1 parent 0608610 commit 7b77923
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7b77923

Please sign in to comment.