diff --git a/odoo/sql_db.py b/odoo/sql_db.py index 640c649a43a3b..00c99e1345649 100644 --- a/odoo/sql_db.py +++ b/odoo/sql_db.py @@ -679,7 +679,7 @@ def connection_info_for(db_or_uri): return db_name, {'dsn': db_or_uri} connection_info = {'database': db_or_uri} - for p in ('host', 'port', 'user', 'password'): + for p in ('host', 'port', 'user', 'password', 'sslmode', 'sslrootcert'): cfg = tools.config['db_' + p] if cfg: connection_info[p] = cfg diff --git a/odoo/tools/config.py b/odoo/tools/config.py index 02f8fde3c342d..b73015bfe0598 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -205,6 +205,10 @@ def __init__(self, fname=None): help="specify the database host") group.add_option("--db_port", dest="db_port", my_default=False, help="specify the database port", type="int") + group.add_option("--db_sslmode", dest="db_sslmode", type="choice", my_default='prefer', + choices=['disable', 'allow', 'prefer', 'require', 'verify-ca', 'verify-full'], + help="specify the database ssl connection mode (see PostgreSQL documentation)") + group.add_option("--db_sslrootcert", dest="db_sslrootcert", help="specify the cert path (see PostgreSQL documentation)") group.add_option("--db_maxconn", dest="db_maxconn", type='int', my_default=64, help="specify the the maximum number of physical connections to posgresql") group.add_option("--db-template", dest="db_template", my_default="template1", @@ -384,10 +388,10 @@ def die(cond, msg): # if defined dont take the configfile value even if the defined value is None keys = ['xmlrpc_interface', 'xmlrpc_port', 'longpolling_port', - 'db_name', 'db_user', 'db_password', 'db_host', - 'db_port', 'db_template', 'logfile', 'pidfile', 'smtp_port', - 'email_from', 'smtp_server', 'smtp_user', 'smtp_password', - 'db_maxconn', 'import_partial', 'addons_path', + 'db_name', 'db_user', 'db_password', 'db_host', 'db_sslmode', + 'db_sslrootcert', 'db_port', 'db_template', 'logfile', 'pidfile', + 'smtp_port', 'email_from', 'smtp_server', 'smtp_user', + 'smtp_password', 'db_maxconn', 'import_partial', 'addons_path', 'xmlrpc', 'syslog', 'without_demo', 'dbfilter', 'log_level', 'log_db', 'log_db_level', 'geoip_database', 'dev_mode', 'shell_interface'