plugins: structure plugin storage in wallet
store all plugin data by plugin name in a root dictionary `plugin_data` inside the wallet db so that plugin data can get deleted again. Prunes the data of plugins from the wallet db on wallet stop if the plugin is not installed anymore.
This commit is contained in:
@@ -4,7 +4,7 @@ import time
|
||||
import os
|
||||
import stat
|
||||
from decimal import Decimal
|
||||
from typing import Union, Optional, Dict, Sequence, Tuple, Any, Set, Callable
|
||||
from typing import Union, Optional, Dict, Sequence, Tuple, Any, Set, Callable, AbstractSet
|
||||
from numbers import Real
|
||||
from functools import cached_property
|
||||
|
||||
@@ -349,6 +349,10 @@ class SimpleConfig(Logger):
|
||||
def is_plugin_enabled(self, name: str) -> bool:
|
||||
return bool(self.get(f'plugins.{name}.enabled'))
|
||||
|
||||
def get_installed_plugins(self) -> AbstractSet[str]:
|
||||
"""Returns all plugin names registered in the config."""
|
||||
return self.get('plugins', {}).keys()
|
||||
|
||||
def enable_plugin(self, name: str):
|
||||
self.set_key(f'plugins.{name}.enabled', True, save=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user