diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-06-14 17:18:57 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-06-14 17:18:57 +0800 |
commit | f35b97948e6ca783ff57b31e1d80f826c287c4ba (patch) | |
tree | e82dbb57b5e5b47736fad7f4832ac0cfc243de5b | |
parent | 1a2ce3cc9d83b2992c4801fcf04eb51bb19912e1 (diff) | |
download | gitlab-ce-f35b97948e6ca783ff57b31e1d80f826c287c4ba.tar.gz |
Bring `rake postgresql_md5_hash` to CE
-rw-r--r-- | lib/tasks/migrate/setup_postgresql.rake | 15 |
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 |