From c5db9320653156ac32612dd92a98d9a4b627fdea Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 21 Feb 2022 22:24:33 +0100 Subject: [PATCH] chore(clean): Drop `_module_path` from flaschengeist --- flaschengeist/__init__.py | 2 -- flaschengeist/config.py | 10 +++++----- flaschengeist/flaschengeist.toml | 23 +++++++++++------------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/flaschengeist/__init__.py b/flaschengeist/__init__.py index 76909c4..e3d4575 100644 --- a/flaschengeist/__init__.py +++ b/flaschengeist/__init__.py @@ -1,10 +1,8 @@ """Flaschengeist""" import logging from importlib.metadata import version -from pathlib import Path __version__ = version("flaschengeist") -_module_path = Path(__file__).parent __pdoc__ = {} logger = logging.getLogger(__name__) diff --git a/flaschengeist/config.py b/flaschengeist/config.py index 3dfb078..49a9a2f 100644 --- a/flaschengeist/config.py +++ b/flaschengeist/config.py @@ -1,12 +1,12 @@ import os import toml -import logging.config import collections.abc from pathlib import Path +from logging.config import dictConfig from werkzeug.middleware.proxy_fix import ProxyFix -from flaschengeist import _module_path, logger +from flaschengeist import logger # Default config: config = {"DATABASE": {"engine": "mysql", "port": 3306}} @@ -23,7 +23,7 @@ def update_dict(d, u): def read_configuration(test_config): global config - paths = [_module_path] + paths = [Path(__file__).parent] if not test_config: paths.append(Path.home() / ".config") @@ -56,7 +56,7 @@ def configure_logger(): logger_config["handlers"]["wsgi"]["level"] = level # Read default config - logger_config = toml.load(_module_path / "logging.toml") + logger_config = toml.load(Path(__file__).parent /"logging.toml") if "LOGGING" in config: # Override with user config update_dict(logger_config, config.get("LOGGING")) @@ -68,7 +68,7 @@ def configure_logger(): if "FG_LOGGING" in os.environ: set_level(os.environ.get("FG_LOGGING", "CRITICAL")) - logging.config.dictConfig(logger_config) + dictConfig(logger_config) def configure_app(app, test_config=None): diff --git a/flaschengeist/flaschengeist.toml b/flaschengeist/flaschengeist.toml index e2d6dc4..bbd9807 100644 --- a/flaschengeist/flaschengeist.toml +++ b/flaschengeist/flaschengeist.toml @@ -12,10 +12,12 @@ root = "/api" secret_key = "V3ryS3cr3t" # Domain used by frontend -[scheduler] -# Possible values are: "passive_web" (default), "active_web" and "system" -# See documentation -# cron = "passive_web" +[DATABASE] +# engine = "mysql" (default) +host = "localhost" +user = "flaschengeist" +password = "flaschengeist" +database = "flaschengeist" [LOGGING] # You can override all settings from the logging.toml here @@ -33,14 +35,6 @@ level = "DEBUG" # encoding = "utf8" # filename = "flaschengeist.log" - -[DATABASE] -# engine = "mysql" (default) -host = "localhost" -user = "flaschengeist" -password = "flaschengeist" -database = "flaschengeist" - [FILES] # Path for file / image uploads data_path = "./data" @@ -54,6 +48,11 @@ allowed_mimetypes = [ "image/webp" ] +[scheduler] +# Possible values are: "passive_web" (default), "active_web" and "system" +# See documentation +# cron = "passive_web" + [auth_ldap] # Full documentation https://flaschengeist.dev/Flaschengeist/flaschengeist/wiki/plugins_auth_ldap # host = "localhost"