mirror of
https://github.com/j93es/oauth-backend.git
synced 2026-06-04 01:21:51 +09:00
HotFix Running Backend
This commit is contained in:
parent
30e2730cb1
commit
ba6064c378
2 changed files with 17 additions and 15 deletions
30
main.py
30
main.py
|
|
@ -1,21 +1,23 @@
|
|||
from runner.proxy import run_proxy
|
||||
import subprocess
|
||||
import threading
|
||||
import uvicorn
|
||||
from runner.backend import app
|
||||
|
||||
def run_fastapi_server():
|
||||
"""FastAPI 서버를 실행하는 함수"""
|
||||
uvicorn.run(app, host="localhost", port=11081, log_level="info")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Start web server in a separate thread
|
||||
server_process = subprocess.Popen([
|
||||
"granian",
|
||||
"--interface", "asgi",
|
||||
"--host", "0.0.0.0",
|
||||
"--port", "11081",
|
||||
"--loop", "asyncio",
|
||||
"--reload",
|
||||
"runner.backend:app",
|
||||
])
|
||||
|
||||
try:
|
||||
# Run mitmdump proxy
|
||||
# FastAPI 서버를 백그라운드 스레드에서 실행
|
||||
fastapi_thread = threading.Thread(target=run_fastapi_server, daemon=True)
|
||||
fastapi_thread.start()
|
||||
print("🚀 FastAPI server started on http://localhost:11081")
|
||||
|
||||
# Run mitmdump proxy (메인 스레드에서 실행)
|
||||
print("🛡️ Starting mitmdump proxy on port 11080...")
|
||||
run_proxy()
|
||||
except KeyboardInterrupt:
|
||||
print("🛑 Shutting down...")
|
||||
finally:
|
||||
server_process.terminate()
|
||||
print("✅ Mitmdump proxy has been stopped.")
|
||||
|
|
@ -20,4 +20,4 @@ async def not_found_handler(request, exc):
|
|||
|
||||
@app.exception_handler(405)
|
||||
async def method_not_allowed_handler(request, exc):
|
||||
return Response(status_code=405)
|
||||
return Response(status_code=405)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue