diff --git a/.env.example b/.env.example index da20ebe..b8e1c1f 100644 --- a/.env.example +++ b/.env.example @@ -3,5 +3,5 @@ DEV_MODE=false APP_LISTEN_ADDRESS=127.0.0.1 APP_LISTEN_PORT=3000 APP_BEHIND_PROXY=false -DATABASE_LOCATION=./people.db +DATABASE_DSN="host=localhost user=camarades password=camarades dbname=camarades port=5432 sslmode=disable TimeZone=Europe/Zurich" SESSIONS_LOCATION=./sessions.db diff --git a/helpers/config.go b/helpers/config.go index 835b7a1..e87443d 100644 --- a/helpers/config.go +++ b/helpers/config.go @@ -15,8 +15,7 @@ type Config struct { BehindProxy bool `env:"APP_BEHIND_PROXY"` } Database struct { - Location string `env:"DATABASE_LOCATION"` - DSN string `env:"DATABASE_DSN"` + DSN string `env:"DATABASE_DSN"` } Sessions struct { Location string `env:"SESSIONS_LOCATION"` diff --git a/helpers/database.go b/helpers/database.go index e4bc052..00ed2f8 100644 --- a/helpers/database.go +++ b/helpers/database.go @@ -42,7 +42,8 @@ func GetDatabase() (*gorm.DB, error) { return database, err } - db.SetMaxOpenConns(1) + db.SetMaxIdleConns(10) + db.SetMaxOpenConns(50) err = database.AutoMigrate( &models.User{},