Perform replacements in the configuration file. The substitutions are passed as a list of search-replace-tuples, e.g. [("old", "new"), ("foo", "bar"), ...]
(self, replacements)
| 533 | assert self.is_node_stopped() |
| 534 | |
| 535 | def replace_in_config(self, replacements): |
| 536 | """ |
| 537 | Perform replacements in the configuration file. |
| 538 | The substitutions are passed as a list of search-replace-tuples, e.g. |
| 539 | [("old", "new"), ("foo", "bar"), ...] |
| 540 | """ |
| 541 | with open(self.bitcoinconf, 'r') as conf: |
| 542 | conf_data = conf.read() |
| 543 | for replacement in replacements: |
| 544 | assert_equal(len(replacement), 2) |
| 545 | old, new = replacement[0], replacement[1] |
| 546 | conf_data = conf_data.replace(old, new) |
| 547 | with open(self.bitcoinconf, 'w') as conf: |
| 548 | conf.write(conf_data) |
| 549 | |
| 550 | @property |
| 551 | def chain_path(self) -> Path: |
no test coverage detected