Skip to content

Commit

Permalink
SDK-usage improvement: app configuration is no longer written to loca…
Browse files Browse the repository at this point in the history
…l file-system if no filename is specified
  • Loading branch information
aaunario-keeper authored and sk-keeper committed Sep 24, 2024
1 parent 54913a0 commit 3f3deb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion keepercommander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# Contact: ops@keepersecurity.com
#

__version__ = '16.11.13'
__version__ = '16.11.14'
12 changes: 8 additions & 4 deletions keepercommander/config_storage/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ def store_config_properties(params):
return
if not isinstance(params.config, dict):
params.config = {}
if not params.config_filename:
params.config_filename = 'config.json'

# commit changes from params to config
for name in PROTECTED_PROPERTIES + EDITABLE_PROPERTIES:
Expand Down Expand Up @@ -115,8 +113,14 @@ def store_config_properties(params):
if isinstance(encrypted_data, bytes):
config_json[ENCRYPTED_DATA] = utils.base64_url_encode(encrypted_data)

with open(params.config_filename, 'w') as fd:
json.dump(config_json, fd, ensure_ascii=False, indent=2)
if params.config_filename:
try:
with open(params.config_filename, 'w') as fd:
json.dump(config_json, fd, ensure_ascii=False, indent=2)
except Exception as error:
logging.debug(error, exc_info=True)
logging.error(f'Failed to write configuration to {params.config_filename}. '
'Type "debug" to toggle verbose logging.', error)


def load_config_properties(params):
Expand Down

0 comments on commit 3f3deb4

Please sign in to comment.