[enh] add blocked_plugins setting do completly remove plugin from query processing

This commit is contained in:
Martin Minka 2022-01-15 13:01:30 +01:00
parent 599d882d0a
commit e04659853a
2 changed files with 10 additions and 1 deletions

View file

@ -226,7 +226,10 @@ def plugin_module_names():
def initialize(app): def initialize(app):
# it is possible to block plugins from being registered into plugin chain
blocked_plugins = settings['outgoing'].get('blocked_plugins', [])
for module_name, external in plugin_module_names(): for module_name, external in plugin_module_names():
plugin = load_and_initialize_plugin(module_name, external, (app, settings)) plugin = load_and_initialize_plugin(module_name, external, (app, settings))
if plugin: if plugin and plugin.name not in blocked_plugins:
plugins.register(plugin) plugins.register(plugin)

View file

@ -157,6 +157,12 @@ outgoing:
# - plugin2 # - plugin2
# - ... # - ...
# Plugins listed here will be loaded, but will not be registered into plugins chain.
# The engine will not use them to process queries.
#
# blocked_plugins:
# - 'Self Informations'
# Comment or un-comment plugin to activate / deactivate by default. # Comment or un-comment plugin to activate / deactivate by default.
# #
# enabled_plugins: # enabled_plugins: