Refactor config logic for bools

If a config paramenter is a boolean, the resulting configuration is the
logic and of all those given (including defaults). BEWARE in future
config implementations!
This commit is contained in:
sfigato 2020-08-29 20:06:08 +02:00
parent 12f37b3a55
commit 6fea75022f
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
2 changed files with 3 additions and 2 deletions

View File

@ -11,7 +11,7 @@ ldap:
encryption: TLSv1.2 # Can either be None or TLSv1.2. Default: None
ciphers: "HIGH"
validate: True # Can either be True or False. Default: False
validate: False # Can either be True or False. Default: False
ca_certs: openldap/cert.pem
username: uid=phi,ou=Services,dc=unit,dc=macaomilano,dc=org
@ -19,7 +19,6 @@ ldap:
base_dn: dc=unit,dc=macaomilano,dc=org
attribute_id: uid
attribute_mail: mail
logging:

View File

@ -125,6 +125,8 @@ def recursive_merge(main_config, aux_config):
if aux is not None:
_main.extend(aux)
_ret_config[key] = list(set(_main))
elif isinstance(default, bool):
_ret_config[key] = default and aux and main
else:
if main is not None:
_ret_config[key] = main