Update main to set everything up (still unused)
This commit is contained in:
parent
12797e3cae
commit
0af1b827aa
1 changed files with 15 additions and 0 deletions
15
src/main.py
15
src/main.py
|
|
@ -1,5 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from src.notifications.service import make_notification_service
|
||||||
|
from src.services.email import get_service as get_email_service
|
||||||
|
from src.services.users import get_service as get_user_service
|
||||||
|
from src.infra.db import get_database
|
||||||
|
from src.infra.users import UserRepoImpl
|
||||||
from waitress import serve
|
from waitress import serve
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
import argparse
|
import argparse
|
||||||
|
|
@ -15,6 +20,16 @@ def create_app(name: str, config: Config) -> Flask:
|
||||||
|
|
||||||
app = Flask(name)
|
app = Flask(name)
|
||||||
|
|
||||||
|
email_service = get_email_service(config.email)
|
||||||
|
notification_service = make_notification_service(email_service)
|
||||||
|
database = get_database(config.database)
|
||||||
|
user_repo = UserRepoImpl(database)
|
||||||
|
user_service = get_user_service(user_repo)
|
||||||
|
|
||||||
|
app.extensions['email'] = email_service
|
||||||
|
app.extensions['notifications'] = notification_service
|
||||||
|
app.extensions['user_service'] = user_service
|
||||||
|
|
||||||
if config.host:
|
if config.host:
|
||||||
app.config['SERVER_NAME'] = config.host
|
app.config['SERVER_NAME'] = config.host
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue