summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-06-14 11:29:05 +0000
committerDouwe Maan <douwe@gitlab.com>2018-06-14 11:29:05 +0000
commit20ca5e3041949c09820fc9e467f7e1b9dd980d6c (patch)
treec0066e9cc2b386aa07b8c86047f9439db750b201
parent431c3f18abc8b555dbc43f1ffe079b577a22c3c6 (diff)
parentf35b97948e6ca783ff57b31e1d80f826c287c4ba (diff)
downloadgitlab-ce-20ca5e3041949c09820fc9e467f7e1b9dd980d6c.tar.gz
Merge branch '6419-unify-setup_postgresql.rake' into 'master'
Bring `rake postgresql_md5_hash` to CE Closes gitlab-ee#6419 See merge request gitlab-org/gitlab-ce!19830
-rw-r--r--lib/tasks/migrate/setup_postgresql.rake15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/tasks/migrate/setup_postgresql.rake b/lib/tasks/migrate/setup_postgresql.rake
index e7aab50e42a..f69d204c579 100644
--- a/lib/tasks/migrate/setup_postgresql.rake
+++ b/lib/tasks/migrate/setup_postgresql.rake
@@ -22,3 +22,18 @@ task setup_postgresql: :environment do
ProjectNameLowerIndex.new.up
AddPathIndexToRedirectRoutes.new.up
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