package db
import (
"log"
"os"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
func Connect() *gorm.DB {
os.Getenv("CLOUDINARY_NAME")
dsn := os.Getenv("DB_URL")
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{
Logger: logger.New(
log.New(log.Writer(), "\r\n", log.LstdFlags),
logger.Config{
SlowThreshold: 200,
Colorful: true,
IgnoreRecordNotFoundError: false,
LogLevel: logger.Info,
},
),
})
if err != nil {
panic(err)
}
return db
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)