lib/pghero/database.rb in pghero-2.0.3 vs lib/pghero/database.rb in pghero-2.0.4
- old
+ new
@@ -66,10 +66,16 @@
url = config["url"]
Class.new(PgHero::Connection) do
def self.name
"PgHero::Connection::Database#{object_id}"
end
- establish_connection(url) if url
+ case url
+ when String
+ url = "#{url}#{url.include?("?") ? "&" : "?"}connect_timeout=2" unless url.include?("connect_timeout=")
+ when Hash
+ url[:connect_timeout] ||= 2
+ end
+ establish_connection url if url
end
end
end
end
end