Load and reuse saved peer ID if there is one.
()
| 89 | |
| 90 | |
| 91 | def _loadPeerId(): |
| 92 | """Load and reuse saved peer ID if there is one.""" |
| 93 | global savedPeerId |
| 94 | conf_file = Path(PEERID_FILE) |
| 95 | if conf_file.exists(): |
| 96 | conf = {} |
| 97 | with conf_file.open() as infile: |
| 98 | conf = yaml.load(infile, Loader=yaml.SafeLoader) |
| 99 | if conf is not None: |
| 100 | savedPeerId = conf.get('peerId', None) |
| 101 | else: |
| 102 | savedPeerId = None |
| 103 | |
| 104 | def _loadConfig(): |
| 105 | logger.info('Loading configuration') |