Sha256: e194352252a4d276fd287d22ccbbbc400345008f637d36899234d3234dcd8c13

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

module PgBouncerHero
  class Connection

    def initialize(host, port, user, password, dbname)
      @host = host
      @port = port
      @user = user
      @password = password
      @dbname = dbname
    end

    def connection
      @connection ||= begin
         begin
          PG.connect(
            host: @host,
            port: @port,
            user: @user,
            password: @password,
            dbname: @dbname,
            connect_timeout: 5
          )
        rescue => e
          Rails.logger.info(e)
          nil
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgbouncerhero-0.1.1 lib/pgbouncerhero/connection.rb