Moved min/max number of db connections to config file
This commit is contained in:
parent
490c82940a
commit
470a0e4932
|
@ -8,5 +8,7 @@ var Config = HMNConfig{
|
|||
Hostname: "handmade.local",
|
||||
Port: 5454,
|
||||
DbName: "hmn",
|
||||
MinConn: 2, // Keep these low for dev, high for production
|
||||
MaxConn: 2,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ type PostgresConfig struct {
|
|||
Port int
|
||||
DbName string
|
||||
LogLevel pgx.LogLevel
|
||||
MinConn int32
|
||||
MaxConn int32
|
||||
}
|
||||
|
||||
type AuthConfig struct {
|
||||
|
|
|
@ -25,7 +25,7 @@ var WebsiteCommand = &cobra.Command{
|
|||
|
||||
logging.Info().Msg("Hello, HMN!")
|
||||
|
||||
conn := db.NewConnPool(4, 128)
|
||||
conn := db.NewConnPool(config.Config.Postgres.MinConn, config.Config.Postgres.MaxConn)
|
||||
|
||||
server := http.Server{
|
||||
Addr: config.Config.Addr,
|
||||
|
|
Loading…
Reference in New Issue