Database SSL support for backup script.

This commit is contained in:
Guillaume 2017-03-05 22:08:15 +01:00
parent 76a15db45f
commit c67271cd78
2 changed files with 25 additions and 5 deletions

View file

@ -0,0 +1,4 @@
---
title: Database SSL support for backup script.
merge_request: 9715
author: Guillaume Simon

View file

@ -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)