From a8d2261f32c4c25787d94c55b7500dda2009dd3f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 29 Apr 2023 11:34:34 +0200 Subject: [PATCH] Added `core_plugins` to the configuration. These plugins (only including `variable` for now) are a core part of the application and should always be explicitly enabled. --- platypush/config/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/platypush/config/__init__.py b/platypush/config/__init__.py index c5151396ea..aa9ca10949 100644 --- a/platypush/config/__init__.py +++ b/platypush/config/__init__.py @@ -11,7 +11,7 @@ import shutil import socket import sys from urllib.parse import quote -from typing import Optional, Set +from typing import Dict, Optional, Set import yaml @@ -129,7 +129,7 @@ class Config: } if 'logging' in self._config: - for (k, v) in self._config['logging'].items(): + for k, v in self._config['logging'].items(): if k == 'filename': logfile = os.path.expanduser(v) logdir = os.path.dirname(logfile) @@ -158,7 +158,7 @@ class Config: os.environ[k] = str(v) self.backends = {} - self.plugins = {} + self.plugins = self._core_plugins self.event_hooks = {} self.procedures = {} self.constants = {} @@ -173,6 +173,12 @@ class Config: self._init_components() self._init_dashboards(self._config['dashboards_dir']) + @property + def _core_plugins(self) -> Dict[str, dict]: + return { + 'variable': {}, + } + def _create_default_config(self): cfg_mod_dir = os.path.dirname(os.path.abspath(__file__)) cfgfile = self._cfgfile_locations[0] @@ -330,7 +336,7 @@ class Config: if 'constants' in self._config: self.constants = self._config['constants'] - for (key, value) in self._default_constants.items(): + for key, value in self._default_constants.items(): self.constants[key] = value def _get_dashboard(