fix: use database.path over database.name

This commit is contained in:
Derrick Hammer 2023-04-30 02:15:57 -04:00
parent 6e0ec8aaf9
commit 25c7d6d4fb
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 1 deletions

View File

@ -27,6 +27,7 @@ func Init() {
dbUser := viper.GetString("database.user") dbUser := viper.GetString("database.user")
dbPassword := viper.GetString("database.password") dbPassword := viper.GetString("database.password")
dbName := viper.GetString("database.name") dbName := viper.GetString("database.name")
dbPath := viper.GetString("database.path")
var err error var err error
var dsn string var dsn string
@ -41,7 +42,7 @@ func Init() {
db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{}) db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
// Connect to a SQLite database. // Connect to a SQLite database.
case "sqlite": case "sqlite":
db, err = gorm.Open(sqlite.Open(dbName), &gorm.Config{}) db, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
// If the database type is unsupported, panic. // If the database type is unsupported, panic.
default: default:
panic(fmt.Errorf("Unsupported database type: %s \n", dbType)) panic(fmt.Errorf("Unsupported database type: %s \n", dbType))