add dynamic verison file

This commit is contained in:
David Rodenkirchen
2024-08-27 00:25:40 +02:00
parent fe5566749d
commit 7be5dc6a9b
3 changed files with 14 additions and 1 deletions
@@ -12,6 +12,13 @@ logger = logging.getLogger(__name__.split(".")[-1])
class ConfigurationService:
def __init__(self, config_file_path: Path) -> None:
try:
with open(from_root("VERSION"), "r") as version_file:
self._version = version_file.read().strip()
except FileNotFoundError:
logger.warning("Could not find VERSION file, defaulting to '0.0.0'")
self._version = "0.0.0"
try:
with open(config_file_path, "rb") as config_file:
self._config = tomllib.load(config_file)
@@ -81,3 +88,7 @@ class ConfigurationService:
except KeyError:
logger.fatal("Error loading seating configuration, exiting...")
sys.exit(1)
@property
def APP_VERSION(self) -> str:
return self._version