Commit c67271cd authored by Guillaume's avatar Guillaume

Database SSL support for backup script.

parent 76a15db4
---
title: Database SSL support for backup script.
merge_request: 9715
author: Guillaume Simon
...@@ -80,16 +80,32 @@ module Backup ...@@ -80,16 +80,32 @@ module Backup
'port' => '--port', 'port' => '--port',
'socket' => '--socket', 'socket' => '--socket',
'username' => '--user', '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 args.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
end end
def pg_env def pg_env
ENV['PGUSER'] = config["username"] if config["username"] args = {
ENV['PGHOST'] = config["host"] if config["host"] 'username' => 'PGUSER',
ENV['PGPORT'] = config["port"].to_s if config["port"] 'host' => 'PGHOST',
ENV['PGPASSWORD'] = config["password"].to_s if config["password"] '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 end
def report_success(success) def report_success(success)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment