Skip to content

Commit

Permalink
Merge pull request #55 from numbata/patch-1
Browse files Browse the repository at this point in the history
Set correct username for pg connection
  • Loading branch information
sgruhier committed Feb 17, 2015
2 parents adedf1c + 25cc795 commit bdcf5f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/capistrano-db-tasks/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ def postgresql?

def credentials
credential_params = ""
username = @config['username'] || @config['user']

if mysql?
username = @config['username'] || @config['user']
credential_params << " -u #{username} " if username
credential_params << " -p'#{@config['password']}' " if @config['password']
credential_params << " -h #{@config['host']} " if @config['host']
credential_params << " -S #{@config['socket']} " if @config['socket']
credential_params << " -P #{@config['port']} " if @config['port']
elsif postgresql?
credential_params << " -U #{@config['username']} " if @config['username']
credential_params << " -U #{username} " if username
credential_params << " -h #{@config['host']} " if @config['host']
credential_params << " -p #{@config['port']} " if @config['port']
end
Expand Down

0 comments on commit bdcf5f9

Please sign in to comment.