Permalink
Browse files

Merge pull request #257 from heroku/chpass-shogun

Credentials reset for Heroku Postgres
  • Loading branch information...
2 parents 22d3251 + 56d4506 commit 21b28e830e74daad4bb0618c72666836a86ed6be @geemus geemus committed Mar 16, 2012
Showing with 11 additions and 1 deletion.
  1. +4 −0 lib/heroku-postgresql/client.rb
  2. +7 −1 lib/heroku/command/pg.rb
@@ -24,6 +24,10 @@ def reset
http_put "#{@database_sha}/reset"
end
+ def rotate_credentials
+ http_put "#{@database_sha}/rotate_credentials"
+ end
+
def get_database
http_get @database_sha
end
View
@@ -146,6 +146,8 @@ def credentials
when true
db = resolve_db(:required => 'pg:reset')
case db[:name]
+ when "SHARED_DATABASE"
+ output_with_bang "Resetting password not currently supported for #{db[:pretty_name]}"
when /\A#{Resolver.shared_addon_prefix}\w+/
working_display 'Resetting' do
return unless confirm_command
@@ -154,7 +156,11 @@ def credentials
heroku.add_config_vars(app, {"DATABASE_URL" => response["url"]}) if db[:default]
end
else
- output_with_bang "Resetting password not currently supported for #{db[:pretty_name]}"
+ working_display 'Resetting' do
+ return unless confirm_command
+ output_with_arrow("Resetting password for #{db[:pretty_name]}")
+ heroku_postgresql_client(db[:url]).rotate_credentials
+ end
end
else
uri = generate_ingress_uri

0 comments on commit 21b28e8

Please sign in to comment.