diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2017-04-24 13:06:00 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2017-04-24 13:06:00 +0000 |
commit | 4740c994514b01eb4c610231872aa44fdd27cf63 (patch) | |
tree | 2d107df9682a1e61bc2336d997ea955b6e55edec /lib/backup | |
parent | 89d6ee8d673cb24ae6e86ac5af211c8e25d92b14 (diff) | |
parent | c67271cd78f3df1090996feabd08bb713c71f7ca (diff) | |
download | gitlab-ce-4740c994514b01eb4c610231872aa44fdd27cf63.tar.gz |
Merge branch 'db-backup-ssl-support' into 'master'
Database SSL support for backup script.
Closes #1440
See merge request !9715
Diffstat (limited to 'lib/backup')
-rw-r--r-- | lib/backup/database.rb | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/backup/database.rb b/lib/backup/database.rb index 4016ac76348..d97e5d98229 100644 --- a/lib/backup/database.rb +++ b/lib/backup/database.rb @@ -80,16 +80,32 @@ module Backup 'port' => '--port', 'socket' => '--socket', 'username' => '--user', - 'encoding' => '--default-character-set' + 'encoding' => '--default-character-set', + # SSL + 'sslkey' => '--ssl-key', + 'sslcert' => '--ssl-cert', + 'sslca' => '--ssl-ca', + 'sslcapath' => '--ssl-capath', + 'sslcipher' => '--ssl-cipher' } args.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact end def pg_env - ENV['PGUSER'] = config["username"] if config["username"] - ENV['PGHOST'] = config["host"] if config["host"] - ENV['PGPORT'] = config["port"].to_s if config["port"] - ENV['PGPASSWORD'] = config["password"].to_s if config["password"] + args = { + 'username' => 'PGUSER', + 'host' => 'PGHOST', + 'port' => 'PGPORT', + 'password' => 'PGPASSWORD', + # SSL + 'sslmode' => 'PGSSLMODE', + 'sslkey' => 'PGSSLKEY', + 'sslcert' => 'PGSSLCERT', + 'sslrootcert' => 'PGSSLROOTCERT', + 'sslcrl' => 'PGSSLCRL', + 'sslcompression' => 'PGSSLCOMPRESSION' + } + args.each { |opt, arg| ENV[arg] = config[opt].to_s if config[opt] } end def report_success(success) |