Merge branch 'master' of github.com:knadh/listmonk

This commit is contained in:
Kailash Nadh 2020-11-21 16:12:39 +05:30
commit a22b274088
4 changed files with 17 additions and 10 deletions

View File

@ -7,8 +7,6 @@ listmonk is a standalone, self-hosted, newsletter and mailing list manager. It i
[![listmonk-dashboard](https://user-images.githubusercontent.com/547147/89733057-87566580-da70-11ea-8160-855f6f046a55.png)](https://listmonk.app) [![listmonk-dashboard](https://user-images.githubusercontent.com/547147/89733057-87566580-da70-11ea-8160-855f6f046a55.png)](https://listmonk.app)
Visit [listmonk.app](https://listmonk.app) Visit [listmonk.app](https://listmonk.app)
> listmonk is **alpha** software and may change and break. Use with caution. That said, it has been in active use at [zerodha.com](https://zerodha.com) where it has processed hundreds of campaigns and tens of millions of e-mails.
## Installation ## Installation
### Docker ### Docker

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"database/sql" "database/sql"
"fmt" "fmt"
"time"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"github.com/lib/pq" "github.com/lib/pq"
@ -84,14 +85,15 @@ type Queries struct {
// dbConf contains database config required for connecting to a DB. // dbConf contains database config required for connecting to a DB.
type dbConf struct { type dbConf struct {
Host string `koanf:"host"` Host string `koanf:"host"`
Port int `koanf:"port"` Port int `koanf:"port"`
User string `koanf:"user"` User string `koanf:"user"`
Password string `koanf:"password"` Password string `koanf:"password"`
DBName string `koanf:"database"` DBName string `koanf:"database"`
SSLMode string `koanf:"ssl_mode"` SSLMode string `koanf:"ssl_mode"`
MaxOpen int `koanf:"max_open"` MaxOpen int `koanf:"max_open"`
MaxIdle int `koanf:"max_idle"` MaxIdle int `koanf:"max_idle"`
MaxLifetime time.Duration `koanf:"max_lifetime"`
} }
// connectDB initializes a database connection. // connectDB initializes a database connection.
@ -104,6 +106,7 @@ func connectDB(c dbConf) (*sqlx.DB, error) {
} }
db.SetMaxOpenConns(c.MaxOpen) db.SetMaxOpenConns(c.MaxOpen)
db.SetMaxIdleConns(c.MaxIdle) db.SetMaxIdleConns(c.MaxIdle)
db.SetConnMaxLifetime(c.MaxLifetime)
return db, nil return db, nil
} }

View File

@ -10,3 +10,6 @@
password = "listmonk" password = "listmonk"
database = "listmonk" database = "listmonk"
ssl_mode = "disable" ssl_mode = "disable"
max_open = 25
max_idle = 25
max_lifetime = "300s"

View File

@ -17,3 +17,6 @@
password = "listmonk" password = "listmonk"
database = "listmonk" database = "listmonk"
ssl_mode = "disable" ssl_mode = "disable"
max_open = 25
max_idle = 25
max_lifetime = "300s"