Attempt to mitigate errors w/ HTTPS
This commit is contained in:
parent
8f7e705092
commit
f5249ae489
4 changed files with 15 additions and 20 deletions
24
main.py
24
main.py
|
|
@ -10,17 +10,6 @@ from services.boss_retrieval import process_boss_file
|
|||
from contextlib import asynccontextmanager
|
||||
import asyncio
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=[settings.frontend_url],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
expose_headers=["Set-Cookie"],
|
||||
)
|
||||
|
||||
async def boss_worker_loop():
|
||||
print("background worker started")
|
||||
while True:
|
||||
|
|
@ -29,10 +18,6 @@ async def boss_worker_loop():
|
|||
process_boss_file()
|
||||
except Exception as e:
|
||||
print(f"worker error: {e}")
|
||||
|
||||
# TODO: actually sync to what schedule says.
|
||||
# for now its set to 1hr just incase pretendo fuckery happens
|
||||
# (such as rotation ending)
|
||||
await asyncio.sleep(3600)
|
||||
|
||||
@asynccontextmanager
|
||||
|
|
@ -44,6 +29,15 @@ async def lifespan(app: FastAPI):
|
|||
|
||||
app = FastAPI(lifespan=lifespan)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=[settings.frontend_url],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
expose_headers=["Set-Cookie"],
|
||||
)
|
||||
|
||||
@app.middleware("http")
|
||||
async def force_cors_on_errors(request: Request, call_next):
|
||||
response = await call_next(request)
|
||||
|
|
|
|||
Loading…
Reference in a new issue