|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path"
|
|
|
|
"path"
|
|
|
|
|
|
|
|
"log"
|
|
|
|
|
|
|
|
|
|
|
|
"gorm.io/driver/sqlite"
|
|
|
|
"gorm.io/driver/sqlite"
|
|
|
|
|
|
|
|
|
|
|
@ -18,6 +19,7 @@ func Init() (*gorm.DB, error) {
|
|
|
|
// github.com/mattn/go-sqlite3
|
|
|
|
// github.com/mattn/go-sqlite3
|
|
|
|
configPath := os.Getenv("CONFIG")
|
|
|
|
configPath := os.Getenv("CONFIG")
|
|
|
|
dbPath := path.Join(configPath, "podgrab.db")
|
|
|
|
dbPath := path.Join(configPath, "podgrab.db")
|
|
|
|
|
|
|
|
log.Println(dbPath)
|
|
|
|
db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
|
|
|
db, err := gorm.Open(sqlite.Open(dbPath), &gorm.Config{})
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("db err: ", err)
|
|
|
|
fmt.Println("db err: ", err)
|
|
|
|