diff options
Diffstat (limited to 'ttun_server')
| -rw-r--r-- | ttun_server/__init__.py | 7 | ||||
| -rw-r--r-- | ttun_server/endpoints.py | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/ttun_server/__init__.py b/ttun_server/__init__.py index d54227a..4af6ca0 100644 --- a/ttun_server/__init__.py +++ b/ttun_server/__init__.py | |||
| @@ -2,10 +2,11 @@ import logging | |||
| 2 | import os | 2 | import os |
| 3 | 3 | ||
| 4 | from fastapi import FastAPI | 4 | from fastapi import FastAPI |
| 5 | from starlette.routing import Host, Route, WebSocketRoute | 5 | from starlette.routing import Host, Route, WebSocketRoute, Mount |
| 6 | 6 | ||
| 7 | from authentication.endpoints import authentication, oauth | ||
| 7 | from proxy import app as proxy_app | 8 | from proxy import app as proxy_app |
| 8 | from ttun_server.endpoints import health, base_endpoints | 9 | from ttun_server.endpoints import health |
| 9 | from ttun_server.websockets import tunnel | 10 | from ttun_server.websockets import tunnel |
| 10 | 11 | ||
| 11 | logging.basicConfig(level=getattr(logging, os.environ.get('LOG_LEVEL', 'INFO'))) | 12 | logging.basicConfig(level=getattr(logging, os.environ.get('LOG_LEVEL', 'INFO'))) |
| @@ -13,6 +14,8 @@ logging.basicConfig(level=getattr(logging, os.environ.get('LOG_LEVEL', 'INFO'))) | |||
| 13 | app = FastAPI( | 14 | app = FastAPI( |
| 14 | debug=True, | 15 | debug=True, |
| 15 | routes=[ | 16 | routes=[ |
| 17 | Mount('/auth/', app=authentication), | ||
| 18 | Mount('/oauth/', app=oauth), | ||
| 16 | WebSocketRoute('/tunnel/', endpoint=tunnel), | 19 | WebSocketRoute('/tunnel/', endpoint=tunnel), |
| 17 | Route('/health/', endpoint=health), | 20 | Route('/health/', endpoint=health), |
| 18 | Host(f'{{subdomain}}.{os.environ['TUNNEL_DOMAIN']}', app=proxy_app) | 21 | Host(f'{{subdomain}}.{os.environ['TUNNEL_DOMAIN']}', app=proxy_app) |
diff --git a/ttun_server/endpoints.py b/ttun_server/endpoints.py index 51c17aa..61e3f21 100644 --- a/ttun_server/endpoints.py +++ b/ttun_server/endpoints.py | |||
| @@ -1,7 +1,2 @@ | |||
| 1 | from fastapi import FastAPI | ||
| 2 | |||
| 3 | base_endpoints = FastAPI() | ||
| 4 | |||
| 5 | @base_endpoints.get('/health/') | ||
| 6 | async def health(): | 1 | async def health(): |
| 7 | return 'OK' | 2 | return 'OK' |
