Allows using different ways to retrieve hosts IP address
This commit is contained in:
parent
97cf1a8f5c
commit
84558826fb
15 changed files with 861 additions and 710 deletions
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue