chore(clean): Drop `_module_path` from flaschengeist

This commit is contained in:
Ferdinand Thiessen 2022-02-21 22:24:33 +01:00
parent 1484d678ce
commit c5db932065
3 changed files with 16 additions and 19 deletions

View File

@ -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__)

View File

@ -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):

View File

@ -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"