Write only the "server_keys" property, leaving the rest of the file as it is.
(params)
| 277 | |
| 278 | |
| 279 | def save_server_keys(params): # type: (KeeperParams) -> None |
| 280 | """Write only the "server_keys" property, leaving the rest of the file as it is.""" |
| 281 | if not params.config_filename: |
| 282 | return |
| 283 | config = {} |
| 284 | if os.path.isfile(params.config_filename): |
| 285 | with open(params.config_filename) as fd: |
| 286 | config = json.load(fd) |
| 287 | if params.config.get('server_keys'): |
| 288 | config['server_keys'] = params.config['server_keys'] |
| 289 | else: |
| 290 | config.pop('server_keys', None) |
| 291 | with open(params.config_filename, 'w') as fd: |
| 292 | json.dump(config, fd, ensure_ascii=False, indent=2) |
| 293 | utils.set_file_permissions(params.config_filename) |
| 294 | |
| 295 | |
| 296 | def server_command(params, args): # type: (KeeperParams, str) -> None |
no test coverage detected