mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
domain settings: Only store the diff with respect to defaults, should make possible migrations easier idk
This commit is contained in:
parent
7e048b85b9
commit
951c6695b8
1 changed files with 5 additions and 2 deletions
|
@ -503,12 +503,15 @@ def _set_domain_settings(domain, domain_settings):
|
|||
if domain not in domain_list()["domains"]:
|
||||
raise YunohostError("domain_name_unknown", domain=domain)
|
||||
|
||||
defaults = _default_domain_settings(domain)
|
||||
diff_with_defaults = {k: v for k, v in domain_settings.items() if defaults.get(k) != v}
|
||||
|
||||
# First create the DOMAIN_SETTINGS_DIR if it doesn't exist
|
||||
if not os.path.exists(DOMAIN_SETTINGS_DIR):
|
||||
os.mkdir(DOMAIN_SETTINGS_DIR)
|
||||
mkdir(DOMAIN_SETTINGS_DIR, mode=0o700)
|
||||
# Save the settings to the .yaml file
|
||||
filepath = f"{DOMAIN_SETTINGS_DIR}/{domain}.yml"
|
||||
write_to_yaml(filepath, domain_settings)
|
||||
write_to_yaml(filepath, diff_with_defaults)
|
||||
|
||||
#
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue