2018-06-22 09:52:58 +03:00
|
|
|
"""Run example of dependency injection in Python."""
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from container import IocContainer
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2018-07-02 16:43:23 +03:00
|
|
|
# Configure container:
|
2018-06-22 09:52:58 +03:00
|
|
|
container = IocContainer(
|
2018-07-02 16:43:23 +03:00
|
|
|
config={
|
|
|
|
'database': {
|
|
|
|
'dsn': ':memory:'
|
|
|
|
},
|
|
|
|
'aws': {
|
|
|
|
'access_key_id': 'KEY',
|
|
|
|
'secret_access_key': 'SECRET'
|
|
|
|
},
|
|
|
|
'auth': {
|
|
|
|
'token_ttl': 3600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
2018-06-22 09:52:58 +03:00
|
|
|
container.logger().addHandler(logging.StreamHandler(sys.stdout))
|
|
|
|
|
|
|
|
# Run application:
|
2018-07-02 16:43:23 +03:00
|
|
|
container.main(*sys.argv[1:])
|