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.
This commit is contained in:
Fabio Manganiello 2023-04-29 11:34:34 +02:00
parent 78cee5d9b0
commit a8d2261f32
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -11,7 +11,7 @@ import shutil
import socket import socket
import sys import sys
from urllib.parse import quote from urllib.parse import quote
from typing import Optional, Set from typing import Dict, Optional, Set
import yaml import yaml
@ -129,7 +129,7 @@ class Config:
} }
if 'logging' in self._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': if k == 'filename':
logfile = os.path.expanduser(v) logfile = os.path.expanduser(v)
logdir = os.path.dirname(logfile) logdir = os.path.dirname(logfile)
@ -158,7 +158,7 @@ class Config:
os.environ[k] = str(v) os.environ[k] = str(v)
self.backends = {} self.backends = {}
self.plugins = {} self.plugins = self._core_plugins
self.event_hooks = {} self.event_hooks = {}
self.procedures = {} self.procedures = {}
self.constants = {} self.constants = {}
@ -173,6 +173,12 @@ class Config:
self._init_components() self._init_components()
self._init_dashboards(self._config['dashboards_dir']) self._init_dashboards(self._config['dashboards_dir'])
@property
def _core_plugins(self) -> Dict[str, dict]:
return {
'variable': {},
}
def _create_default_config(self): def _create_default_config(self):
cfg_mod_dir = os.path.dirname(os.path.abspath(__file__)) cfg_mod_dir = os.path.dirname(os.path.abspath(__file__))
cfgfile = self._cfgfile_locations[0] cfgfile = self._cfgfile_locations[0]
@ -330,7 +336,7 @@ class Config:
if 'constants' in self._config: if 'constants' in self._config:
self.constants = self._config['constants'] 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 self.constants[key] = value
def _get_dashboard( def _get_dashboard(