Bring rake postgresql_md5_hash
to CE
This commit is contained in:
parent
1a2ce3cc9d
commit
f35b97948e
1 changed files with 15 additions and 0 deletions
|
@ -22,3 +22,18 @@ task setup_postgresql: :environment do
|
||||||
ProjectNameLowerIndex.new.up
|
ProjectNameLowerIndex.new.up
|
||||||
AddPathIndexToRedirectRoutes.new.up
|
AddPathIndexToRedirectRoutes.new.up
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'GitLab | Generate PostgreSQL Password Hash'
|
||||||
|
task :postgresql_md5_hash do
|
||||||
|
require 'digest'
|
||||||
|
username = ENV.fetch('USERNAME') do |missing|
|
||||||
|
puts "You must provide an username with '#{missing}' ENV variable"
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
password = ENV.fetch('PASSWORD') do |missing|
|
||||||
|
puts "You must provide a password with '#{missing}' ENV variable"
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
hash = Digest::MD5.hexdigest("#{password}#{username}")
|
||||||
|
puts "The MD5 hash of your database password for user: #{username} -> #{hash}"
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue