-
-
Save ninjapanzer/4595366 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
require 'uri' | |
desc "Uses heroku:config for APP to forcefully create ~/.pgpass" | |
task :create_pgpass do | |
app = ENV['APP'] || 'whatever-your-default-app-is' | |
uri = URI(`heroku config:get DATABASE_URL -a #{app}`) | |
entry = "*:5432:#{uri.path.gsub /\//, ''}:#{uri.user}:#{uri.password}" | |
`echo '#{entry}' > ~/.pgpass; chmod 0600 ~/.pgpass` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment