now up and running using docker

This commit is contained in:
2025-04-17 15:22:55 +02:00
parent 5337da219e
commit 22b6f3bd2a
10 changed files with 80 additions and 117 deletions

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"os"
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
@@ -21,11 +21,11 @@ func Connect() error {
dbName := os.Getenv("DB_NAME")
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%s)/%s?parseTime=true",
dbUser, dbPassword, dbHost, dbPort, dbName,
"host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
dbHost, dbPort, dbUser, dbPassword, dbName,
)
db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
db, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
return fmt.Errorf("failed to connect to database: %w", err)
}