PostgreSQL: update config & connection pool
This commit is contained in:
parent
a89a9776c3
commit
e2de88b25b
3 changed files with 4 additions and 4 deletions
|
|
@ -3,5 +3,5 @@ DEV_MODE=false
|
||||||
APP_LISTEN_ADDRESS=127.0.0.1
|
APP_LISTEN_ADDRESS=127.0.0.1
|
||||||
APP_LISTEN_PORT=3000
|
APP_LISTEN_PORT=3000
|
||||||
APP_BEHIND_PROXY=false
|
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
|
SESSIONS_LOCATION=./sessions.db
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ type Config struct {
|
||||||
BehindProxy bool `env:"APP_BEHIND_PROXY"`
|
BehindProxy bool `env:"APP_BEHIND_PROXY"`
|
||||||
}
|
}
|
||||||
Database struct {
|
Database struct {
|
||||||
Location string `env:"DATABASE_LOCATION"`
|
|
||||||
DSN string `env:"DATABASE_DSN"`
|
DSN string `env:"DATABASE_DSN"`
|
||||||
}
|
}
|
||||||
Sessions struct {
|
Sessions struct {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ func GetDatabase() (*gorm.DB, error) {
|
||||||
return database, err
|
return database, err
|
||||||
}
|
}
|
||||||
|
|
||||||
db.SetMaxOpenConns(1)
|
db.SetMaxIdleConns(10)
|
||||||
|
db.SetMaxOpenConns(50)
|
||||||
|
|
||||||
err = database.AutoMigrate(
|
err = database.AutoMigrate(
|
||||||
&models.User{},
|
&models.User{},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue