Some checks failed
publish docs / publish-docs (push) Has been cancelled
release-please / release-please (push) Has been cancelled
tests / setup (push) Has been cancelled
tests / ${{ matrix.quality-command }} (black) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (mypy) (push) Has been cancelled
tests / ${{ matrix.quality-command }} (ruff) (push) Has been cancelled
tests / test (push) Has been cancelled
tests / all_checks_passed (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
20 lines
537 B
Python
20 lines
537 B
Python
from injector import Injector
|
|
|
|
from private_gpt.settings.settings import Settings, unsafe_typed_settings
|
|
|
|
|
|
def create_application_injector() -> Injector:
|
|
_injector = Injector(auto_bind=True)
|
|
_injector.binder.bind(Settings, to=unsafe_typed_settings)
|
|
return _injector
|
|
|
|
|
|
"""
|
|
Global injector for the application.
|
|
|
|
Avoid using this reference, it will make your code harder to test.
|
|
|
|
Instead, use the `request.state.injector` reference, which is bound to every request
|
|
"""
|
|
global_injector: Injector = create_application_injector()
|