python-dependency-injector/tests/unit/samples/schemasample/container-multiple.yml

44 lines
1.0 KiB
YAML
Raw Normal View History

2021-02-24 02:03:09 +03:00
version: "1"
2021-02-26 20:44:53 +03:00
container:
2021-02-24 02:03:09 +03:00
core:
2021-02-26 20:44:53 +03:00
config:
provider: Configuration
2021-02-24 02:03:09 +03:00
gateways:
2021-02-26 20:44:53 +03:00
database_client:
provider: Singleton
provides: sqlite3.connect
args:
- container.core.config.database.dsn
2021-02-24 02:03:09 +03:00
2021-02-26 20:44:53 +03:00
s3_client:
provider: Singleton
provides: boto3.client
kwargs:
service_name: s3
aws_access_key_id: container.core.config.aws.access_key_id
aws_secret_access_key: container.core.config.aws.secret_access_key
2021-02-24 02:03:09 +03:00
services:
2021-02-26 20:44:53 +03:00
user:
provider: Factory
provides: schemasample.services.UserService
kwargs:
db: container.gateways.database_client
2021-02-24 02:03:09 +03:00
2021-02-26 20:44:53 +03:00
auth:
provider: Factory
provides: schemasample.services.AuthService
kwargs:
db: container.gateways.database_client
token_ttl: container.core.config.auth.token_ttl.as_int()
2021-02-24 02:03:09 +03:00
2021-02-26 20:44:53 +03:00
photo:
provider: Factory
provides: schemasample.services.PhotoService
kwargs:
db: container.gateways.database_client
s3: container.gateways.s3_client