Basic injects

This commit is contained in:
Piotr Dec 2025-10-12 20:30:43 +02:00
parent 2d3699ad00
commit 232920683a
Signed by: stawros
GPG key ID: 74B18A3F0F1E99C0
7 changed files with 29 additions and 19 deletions

View file

@ -1,24 +1,20 @@
from typing import Annotated
from injectable import injectable, autowired, Autowired
from app.model.healthcheck import HealthCheck
from app.services import DockerService, GitService, Passwords
# @injectable
class WebhookProcessor:
def __init__(self):
try:
self._docker = DockerService()
except Exception as e:
self._docker = None
print(e)
try:
self._git = GitService()
except Exception as e:
self._git = None
print(f"{type(e).__name__}: {e}")
try:
self._keepass = Passwords()
except Exception as e:
self._keepass = None
print(e)
@autowired
def __init__(self, docker: Annotated[DockerService, Autowired],
git: Annotated[GitService, Autowired],
keepass: Annotated[Passwords, Autowired]):
self._docker = docker
self._git = git
self._keepass = keepass
@property
def health(self) -> HealthCheck: