Write only the "server_keys" property, leaving the rest of the file as it is.
(params)
| 291 | |
| 292 | |
| 293 | def save_server_keys(params): # type: (KeeperParams) -> None |
| 294 | """Write only the "server_keys" property, leaving the rest of the file as it is.""" |
| 295 | if not params.config_filename: |
| 296 | return |
| 297 | config = {} |
| 298 | if os.path.isfile(params.config_filename): |
| 299 | with open(params.config_filename) as fd: |
| 300 | config = json.load(fd) |
| 301 | if params.config.get('server_keys'): |
| 302 | config['server_keys'] = params.config['server_keys'] |
| 303 | else: |
| 304 | config.pop('server_keys', None) |
| 305 | with open(params.config_filename, 'w') as fd: |
| 306 | json.dump(config, fd, ensure_ascii=False, indent=2) |
| 307 | utils.set_file_permissions(params.config_filename) |
| 308 | |
| 309 | |
| 310 | def server_command(params, args): # type: (KeeperParams, str) -> None |
no test coverage detected