From a25e214a9dece5c54a784e184e8e8726c9267abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor?= Date: Fri, 3 May 2024 11:57:04 -0300 Subject: [PATCH 1/2] Corrige tsl config --- src/controller/pautaController.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controller/pautaController.py b/src/controller/pautaController.py index dab2ae5..aa88ebd 100644 --- a/src/controller/pautaController.py +++ b/src/controller/pautaController.py @@ -23,8 +23,8 @@ MAIL_FROM = MAIL_FROM, MAIL_PORT = MAIL_PORT, MAIL_SERVER = MAIL_SERVER, - MAIL_STARTTLS = False, - MAIL_SSL_TLS = True, + MAIL_STARTTLS = True, + MAIL_SSL_TLS = False, USE_CREDENTIALS = True, VALIDATE_CERTS = True ) From 69a8064b278896edad8fe3ab0918a90ab7fbeeb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor?= Date: Wed, 4 Sep 2024 17:19:31 -0300 Subject: [PATCH 2/2] Adiciona vercel --- .gitignore | 3 ++- index.py | 6 ++++++ src/controller/pautaController.py | 3 --- src/main.py | 18 +++++++++--------- vercel.json | 15 +++++++++++++++ 5 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 index.py create mode 100644 vercel.json diff --git a/.gitignore b/.gitignore index c38aee7..c631ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ venv .env env /enviroments -# \ No newline at end of file +# +.vercel diff --git a/index.py b/index.py new file mode 100644 index 0000000..a1b285c --- /dev/null +++ b/index.py @@ -0,0 +1,6 @@ +import uvicorn + + +if __name__ == '__main__': # pragma: no cover + port = 8002 + uvicorn.run('src.main:app', reload=True, port=int(port), host="0.0.0.0") \ No newline at end of file diff --git a/src/controller/pautaController.py b/src/controller/pautaController.py index aa88ebd..7be442e 100644 --- a/src/controller/pautaController.py +++ b/src/controller/pautaController.py @@ -1,5 +1,4 @@ import os -from dotenv import load_dotenv from fastapi_mail import ConnectionConfig, FastMail, MessageSchema, MessageType from ..domain.models.pautaSchema import EmailSchema from starlette.responses import JSONResponse @@ -9,8 +8,6 @@ prefix="/pauta" ) -load_dotenv() - MAIL_USERNAME=os.getenv("MAIL_USERNAME") MAIL_PASSWORD=os.getenv("MAIL_PASSWORD") MAIL_FROM=os.getenv("MAIL_FROM") diff --git a/src/main.py b/src/main.py index df6f58a..1348427 100644 --- a/src/main.py +++ b/src/main.py @@ -1,9 +1,9 @@ -from typing import List from fastapi.middleware.cors import CORSMiddleware -from fastapi import BackgroundTasks, FastAPI +from fastapi import FastAPI + + from src.controller import pautaController -import sys -import uvicorn +# import sys app = FastAPI() @@ -24,10 +24,10 @@ def read_root(): return {"message": "UnB-TV!"} -if __name__ == '__main__': - port = 8080 - if (len(sys.argv) == 2): - port = sys.argv[1] +# if __name__ == '__main__': +# port = 8080 +# if (len(sys.argv) == 2): +# port = sys.argv[1] - uvicorn.run('main:app', reload=True, port=int(port), host="0.0.0.0") +# uvicorn.run('main:app', reload=True, port=int(port), host="0.0.0.0") diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..cfbd1ec --- /dev/null +++ b/vercel.json @@ -0,0 +1,15 @@ +{ + "builds": [ + { + "src": "src/main.py", + "use": "@vercel/python", + "config": {"maxLambdaSize": "15mb"} + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "src/main.py" + } + ] +}