chore(clean): Drop `_module_path` from flaschengeist
This commit is contained in:
parent
1484d678ce
commit
c5db932065
|
@ -1,10 +1,8 @@
|
||||||
"""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__)
|
||||||
|
|
|
@ -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 = [_module_path]
|
paths = [Path(__file__).parent]
|
||||||
|
|
||||||
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(_module_path / "logging.toml")
|
logger_config = toml.load(Path(__file__).parent /"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"))
|
||||||
|
|
||||||
logging.config.dictConfig(logger_config)
|
dictConfig(logger_config)
|
||||||
|
|
||||||
|
|
||||||
def configure_app(app, test_config=None):
|
def configure_app(app, test_config=None):
|
||||||
|
|
|
@ -12,10 +12,12 @@ root = "/api"
|
||||||
secret_key = "V3ryS3cr3t"
|
secret_key = "V3ryS3cr3t"
|
||||||
# Domain used by frontend
|
# Domain used by frontend
|
||||||
|
|
||||||
[scheduler]
|
[DATABASE]
|
||||||
# Possible values are: "passive_web" (default), "active_web" and "system"
|
# engine = "mysql" (default)
|
||||||
# See documentation
|
host = "localhost"
|
||||||
# cron = "passive_web"
|
user = "flaschengeist"
|
||||||
|
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
|
||||||
|
@ -33,14 +35,6 @@ 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"
|
||||||
|
@ -54,6 +48,11 @@ 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"
|
||||||
|
|
Loading…
Reference in New Issue