From 25d7fc96d0c94327a6f9d476a97dcd03c29111ed Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 10 May 2023 14:40:17 +0400 Subject: [PATCH] Add method Diversipub::Main#postgresql_pool --- lib/diversipub/main.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/diversipub/main.rb b/lib/diversipub/main.rb index e9f479c..a593ff5 100644 --- a/lib/diversipub/main.rb +++ b/lib/diversipub/main.rb @@ -81,6 +81,19 @@ module Diversipub end.freeze end + def postgresql_pool + @postgresql_pool ||= ConnectionPool.new do + PG.connect( + host: 'localhost', + dbname: 'diversipub', + user: 'diversipub', + password: 'diversipub', + ).tap do |conn| + conn.type_map_for_results = PG::BasicTypeMapForResults.new conn + end + end + end + def puma_task @puma_task ||= PumaTask.new self end