Permalink
Browse files

Ensure that a database given via --uri makes it into the list of data…

…bases.
  • Loading branch information...
1 parent 444f99f commit b4bd79596f4c9875f89ea699cb98df40b74e5508 @wayneeseguin committed Apr 24, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/psql-cm/database.rb
View
@@ -84,6 +84,11 @@ def configure!
timeout = query.detect { |k| k.match /connect_timeout=/ }.to_s.sub(/.*=/,'')
sslmode = query.detect { |k| k.match /sslmode=/ }.to_s.sub(/.*=/,'')
+ database = uri.path.split('/').first
+ if database && ! @config.databases.detect { |name| name == database }
+ @config.databases << database
+ end
+
@config.connection = {
:host => uri.host,
:port => uri.port || 5432,

0 comments on commit b4bd795

Please sign in to comment.