core: add 'core' config section, add disabled_modules/enabled_modules configs, use them for hpi modules and hpi doctor

This commit is contained in:
Dima Gerasimov 2020-09-28 18:53:58 +02:00 committed by karlicoss
parent f939daac99
commit 70c801f692
6 changed files with 121 additions and 35 deletions

View file

@ -40,12 +40,11 @@ def cache_dir() -> Path:
class config:
cache_dir = '/your/custom/cache/path'
'''
import my.config as C
common_config = getattr(C, 'common', object())
# TODO if attr is set _and_ it's none, disable cache?
cdir = getattr(common_config, 'cache_dir', None)
from .core_config import config
cdir = config.cache_dir
if cdir is None:
# TODO fallback to default cachew dir instead?
# TODO handle this in core_config.py
# TODO fallback to default cachew dir instead? or appdirs cache
return Path('/var/tmp/cachew')
else:
return Path(cdir)