mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-23 01:56:58 +03:00
22 lines
442 B
Python
22 lines
442 B
Python
|
"""Containers module."""
|
||
|
|
||
|
from dependency_injector import containers, providers
|
||
|
|
||
|
from . import redis, services
|
||
|
|
||
|
|
||
|
class Container(containers.DeclarativeContainer):
|
||
|
|
||
|
config = providers.Configuration()
|
||
|
|
||
|
redis_pool = providers.Resource(
|
||
|
redis.init_redis_pool,
|
||
|
host=config.redis_host,
|
||
|
password=config.redis_password,
|
||
|
)
|
||
|
|
||
|
service = providers.Factory(
|
||
|
services.Service,
|
||
|
redis=redis_pool,
|
||
|
)
|