mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Delete a setting properly
This commit is contained in:
parent
3da8cb3537
commit
e52e5187e1
2 changed files with 7 additions and 2 deletions
|
@ -334,6 +334,10 @@ app:
|
|||
-v:
|
||||
full: --value
|
||||
help: Value to set
|
||||
-d:
|
||||
full: --delete
|
||||
help: Delete the key
|
||||
action: store_true
|
||||
|
||||
### app_checkport()
|
||||
checkport:
|
||||
|
|
|
@ -544,7 +544,7 @@ def app_removeaccess(apps, users):
|
|||
app_ssowatconf()
|
||||
|
||||
|
||||
def app_setting(app, key, value=None):
|
||||
def app_setting(app, key, value=None, delete=False):
|
||||
"""
|
||||
Set ou get an app setting value
|
||||
|
||||
|
@ -552,6 +552,7 @@ def app_setting(app, key, value=None):
|
|||
value -- Value to set
|
||||
app -- App ID
|
||||
key -- Key to get/set
|
||||
delete -- Delete the key
|
||||
|
||||
"""
|
||||
settings_file = apps_setting_path + app +'/settings.yml'
|
||||
|
@ -571,7 +572,7 @@ def app_setting(app, key, value=None):
|
|||
# Set the value
|
||||
if app_settings is None:
|
||||
app_settings = {}
|
||||
if value == '' and key in app_settings:
|
||||
if delete and key in app_settings:
|
||||
del app_settings[key]
|
||||
else:
|
||||
app_settings[key] = value
|
||||
|
|
Loading…
Reference in a new issue