Compare commits

..

1 Commits

3 changed files with 19 additions and 16 deletions

View File

@ -1,8 +1,10 @@
"""Flaschengeist""" """Flaschengeist"""
import logging import logging
from importlib.metadata import version from importlib.metadata import version
from pathlib import Path
__version__ = version("flaschengeist") __version__ = version("flaschengeist")
_module_path = Path(__file__).parent
__pdoc__ = {} __pdoc__ = {}
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,12 +1,12 @@
import os import os
import toml import toml
import logging.config
import collections.abc import collections.abc
from pathlib import Path from pathlib import Path
from logging.config import dictConfig
from werkzeug.middleware.proxy_fix import ProxyFix from werkzeug.middleware.proxy_fix import ProxyFix
from flaschengeist import _module_path, logger
from flaschengeist import logger
# Default config: # Default config:
config = {"DATABASE": {"engine": "mysql", "port": 3306}} config = {"DATABASE": {"engine": "mysql", "port": 3306}}
@ -23,7 +23,7 @@ def update_dict(d, u):
def read_configuration(test_config): def read_configuration(test_config):
global config global config
paths = [Path(__file__).parent] paths = [_module_path]
if not test_config: if not test_config:
paths.append(Path.home() / ".config") paths.append(Path.home() / ".config")
@ -56,7 +56,7 @@ def configure_logger():
logger_config["handlers"]["wsgi"]["level"] = level logger_config["handlers"]["wsgi"]["level"] = level
# Read default config # Read default config
logger_config = toml.load(Path(__file__).parent /"logging.toml") logger_config = toml.load(_module_path / "logging.toml")
if "LOGGING" in config: if "LOGGING" in config:
# Override with user config # Override with user config
update_dict(logger_config, config.get("LOGGING")) update_dict(logger_config, config.get("LOGGING"))
@ -68,7 +68,7 @@ def configure_logger():
if "FG_LOGGING" in os.environ: if "FG_LOGGING" in os.environ:
set_level(os.environ.get("FG_LOGGING", "CRITICAL")) set_level(os.environ.get("FG_LOGGING", "CRITICAL"))
dictConfig(logger_config) logging.config.dictConfig(logger_config)
def configure_app(app, test_config=None): def configure_app(app, test_config=None):

View File

@ -12,12 +12,10 @@ root = "/api"
secret_key = "V3ryS3cr3t" secret_key = "V3ryS3cr3t"
# Domain used by frontend # Domain used by frontend
[DATABASE] [scheduler]
# engine = "mysql" (default) # Possible values are: "passive_web" (default), "active_web" and "system"
host = "localhost" # See documentation
user = "flaschengeist" # cron = "passive_web"
password = "flaschengeist"
database = "flaschengeist"
[LOGGING] [LOGGING]
# You can override all settings from the logging.toml here # You can override all settings from the logging.toml here
@ -35,6 +33,14 @@ level = "DEBUG"
# encoding = "utf8" # encoding = "utf8"
# filename = "flaschengeist.log" # filename = "flaschengeist.log"
[DATABASE]
# engine = "mysql" (default)
host = "localhost"
user = "flaschengeist"
password = "flaschengeist"
database = "flaschengeist"
[FILES] [FILES]
# Path for file / image uploads # Path for file / image uploads
data_path = "./data" data_path = "./data"
@ -48,11 +54,6 @@ allowed_mimetypes = [
"image/webp" "image/webp"
] ]
[scheduler]
# Possible values are: "passive_web" (default), "active_web" and "system"
# See documentation
# cron = "passive_web"
[auth_ldap] [auth_ldap]
# Full documentation https://flaschengeist.dev/Flaschengeist/flaschengeist/wiki/plugins_auth_ldap # Full documentation https://flaschengeist.dev/Flaschengeist/flaschengeist/wiki/plugins_auth_ldap
# host = "localhost" # host = "localhost"