From 7b134f2dfbb9d866049857f66e4c4d950d952008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Ma=C3=AFzi?= Date: Mon, 6 Jul 2020 13:20:13 +0200 Subject: [PATCH] FIX non lecture des params pour halfapi run. --- halfapi/cli.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/halfapi/cli.py b/halfapi/cli.py index 24d35e7..df0e0d1 100755 --- a/halfapi/cli.py +++ b/halfapi/cli.py @@ -74,16 +74,11 @@ def run(host, port, debug, dev, dbname, dbhost, dbport, dbuser, dbpassword): HALFORM_DSN=os.environ.get('HALFORM_DSN', '') db_params = dsntodict(HALFORM_DSN) - if not hasattr(db_params, 'dbname'): - db_params['dbname'] = dbname - if not hasattr(db_params, 'host'): - db_params['host'] = dbhost - if not hasattr(db_params, 'port'): - db_params['port'] = dbport - if not hasattr(db_params, 'user'): - db_params['user'] = dbuser - if not hasattr(db_params, 'password'): - db_params['password'] = dbpassword + db_params['dbname'] = db_params.get('dbname', dbname) + db_params['host'] = db_params.get('host', dbhost) + db_params['port'] = db_params.get('port', dbport) + db_params['user'] = db_params.get('user', dbuser) + db_params['password'] = db_params.get('password', dbpassword) os.environ['HALFORM_DSN'] = dicttodsn(db_params)