Adapter refactor
All checks were successful
ci/woodpecker/push/tests Pipeline was successful

Allows using different ways to retrieve hosts IP address
This commit is contained in:
Sonny Bakker 2025-05-03 13:12:13 +02:00 committed by sonny
parent 97cf1a8f5c
commit 84558826fb
15 changed files with 861 additions and 710 deletions

View file

@ -1,24 +1,32 @@
import os
import subprocess
from logging.config import dictConfig
from pathlib import Path
from dotenv import load_dotenv
from ruamel.yaml import YAML
yml = YAML(typ="safe", pure=True)
env_path = Path("..") / ".env"
load_dotenv(dotenv_path=env_path)
default_config_path = Path(__file__).resolve().parent / "logging" / "default.yml"
logging_config_path = os.environ.get("LOGGING_CONFIG", default_config_path)
with open(logging_config_path, "r") as f:
logging_config = yml.load(f.read())
dictConfig(logging_config)
def get_current_version():
if "VERSION" in os.environ:
return os.environ["VERSION"]
try:
output = subprocess.check_output(
["git", "describe", "--tags"], universal_newlines=True
)
output = subprocess.check_output(["git", "describe", "--tags"], text=True)
return output.strip()
except (subprocess.CalledProcessError, OSError):
return ""
@ -32,6 +40,7 @@ try:
sentry_init(
dsn=os.environ.get("SENTRY_DSN"),
environment=os.environ.get("ENVIRONMENT", "production"),
send_default_pii=False,
release=VERSION,
)