Skip to content

Commit bdcf5f9

Browse files
committed
Merge pull request #55 from numbata/patch-1
Set correct username for pg connection
2 parents adedf1c + 25cc795 commit bdcf5f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/capistrano-db-tasks/database.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ def postgresql?
1515

1616
def credentials
1717
credential_params = ""
18+
username = @config['username'] || @config['user']
19+
1820
if mysql?
19-
username = @config['username'] || @config['user']
2021
credential_params << " -u #{username} " if username
2122
credential_params << " -p'#{@config['password']}' " if @config['password']
2223
credential_params << " -h #{@config['host']} " if @config['host']
2324
credential_params << " -S #{@config['socket']} " if @config['socket']
2425
credential_params << " -P #{@config['port']} " if @config['port']
2526
elsif postgresql?
26-
credential_params << " -U #{@config['username']} " if @config['username']
27+
credential_params << " -U #{username} " if username
2728
credential_params << " -h #{@config['host']} " if @config['host']
2829
credential_params << " -p #{@config['port']} " if @config['port']
2930
end

0 commit comments

Comments
 (0)