Module: Capistrano::Postgresql::PasswordHelpers

Defined in:
lib/capistrano/postgresql/password_helpers.rb

Instance Method Summary collapse

Instance Method Details

#ask_for_or_generate_passwordObject

This method is invoked only if :pg_password is not already set in config/#:stage/deploy.rb. Directly setting :pg_password has precedence.



12
13
14
15
16
17
18
# File 'lib/capistrano/postgresql/password_helpers.rb', line 12

def ask_for_or_generate_password
  if fetch(:pg_ask_for_password)
    ask :pg_password, "Postgresql database password for the app: "
  else
    set :pg_password, generate_random_password
  end
end

#generate_random_passwordObject



7
8
9
# File 'lib/capistrano/postgresql/password_helpers.rb', line 7

def generate_random_password
  SecureRandom.hex(10)
end