From d4a3422281deb7fc9480bd404c1a3bb813d729f9 Mon Sep 17 00:00:00 2001
From: Yanislav Igonin <yanislavdabest@gmail.com>
Date: Thu, 30 Sep 2021 20:55:34 +0300
Subject: [PATCH] feat: take postgres max conn from connection url

---
 .env.example | 2 +-
 db/db.go     | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/.env.example b/.env.example
index 0769a0d..09f20c1 100644
--- a/.env.example
+++ b/.env.example
@@ -2,4 +2,4 @@ ENV=debug
 PORT=3000
 SEED_DB=true
 IS_RATE_LIMITER_ENABLED=true
-POSTGRES_URL=postgres://localhost/micrach
\ No newline at end of file
+POSTGRES_URL=postgres://localhost/micrach?pool_max_conns=5
\ No newline at end of file
diff --git a/db/db.go b/db/db.go
index 1e0a655..e3edb7e 100644
--- a/db/db.go
+++ b/db/db.go
@@ -19,8 +19,5 @@ func Init() {
 		log.Panicln(err)
 	}
 
-	// TODO: take from config from env var
-	Pool.Config().MaxConns = 5
-
 	log.Println("database - online")
 }