mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 13:05:21 +02:00
refactor(backend): ♻️ add initial support for global dependency injection
This commit is contained in:
parent
0f6f81eb27
commit
da501adce8
2 changed files with 17 additions and 0 deletions
|
@ -173,3 +173,13 @@ class AppSettings(BaseSettings):
|
||||||
|
|
||||||
|
|
||||||
settings = AppSettings()
|
settings = AppSettings()
|
||||||
|
|
||||||
|
|
||||||
|
def get_app_dirs() -> AppDirectories:
|
||||||
|
global app_dirs
|
||||||
|
return app_dirs
|
||||||
|
|
||||||
|
|
||||||
|
def get_settings() -> AppSettings:
|
||||||
|
global settings
|
||||||
|
return settings
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
from .data_access_layer import DatabaseAccessLayer
|
from .data_access_layer import DatabaseAccessLayer
|
||||||
|
|
||||||
db = DatabaseAccessLayer()
|
db = DatabaseAccessLayer()
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def get_database():
|
||||||
|
return db
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue