lib/flare_up/connection.rb in flare-up-0.9 vs lib/flare_up/connection.rb in flare-up-0.10
- old
+ new
@@ -20,17 +20,17 @@
attr_accessor :dbname
attr_accessor :user
attr_accessor :password
attr_accessor :connect_timeout
- def initialize(host, dbname, user, password)
+ def initialize(host, dbname, user, password, port)
@host = host
@dbname = dbname
@user = user
@password = password
- @port = 5439
+ @port = port
@connect_timeout = 5
end
def execute(statement)
connection.async_exec(statement)
@@ -52,11 +52,11 @@
rescue PG::ConnectionBad => e
case e.message
when /nodename nor servname provided, or not known/
raise HostUnknownOrInaccessibleError, "Host unknown or unreachable: #{@host}"
when /timeout expired/
- raise TimeoutError, 'Timeout connecting to the database (have you checked your Redshift security groups?)'
+ raise TimeoutError, "Timeout connecting to the database (have you checked your Redshift security groups?)"
when /database ".+" does not exist/
raise NoDatabaseError, "Database #{@dbname} does not exist"
when /password authentication failed for user/
raise AuthenticationError, "Either username '#{@user}' or password invalid"
else
@@ -87,6 +87,6 @@
}
end
end
-end
\ No newline at end of file
+end