summaryrefslogtreecommitdiffstats
path: root/ttun_server/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ttun_server/__init__.py')
-rw-r--r--ttun_server/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ttun_server/__init__.py b/ttun_server/__init__.py
index 4af6ca0..f5d6b45 100644
--- a/ttun_server/__init__.py
+++ b/ttun_server/__init__.py
@@ -2,8 +2,10 @@ import logging
2import os 2import os
3 3
4from fastapi import FastAPI 4from fastapi import FastAPI
5from starlette.middleware.authentication import AuthenticationMiddleware
5from starlette.routing import Host, Route, WebSocketRoute, Mount 6from starlette.routing import Host, Route, WebSocketRoute, Mount
6 7
8from authentication.backend import BearerTokenAuthBackend
7from authentication.endpoints import authentication, oauth 9from authentication.endpoints import authentication, oauth
8from proxy import app as proxy_app 10from proxy import app as proxy_app
9from ttun_server.endpoints import health 11from ttun_server.endpoints import health
@@ -16,12 +18,17 @@ app = FastAPI(
16 routes=[ 18 routes=[
17 Mount('/auth/', app=authentication), 19 Mount('/auth/', app=authentication),
18 Mount('/oauth/', app=oauth), 20 Mount('/oauth/', app=oauth),
19 WebSocketRoute('/tunnel/', endpoint=tunnel), 21 WebSocketRoute(
22 '/tunnel/',
23 endpoint=tunnel,
24 ),
20 Route('/health/', endpoint=health), 25 Route('/health/', endpoint=health),
21 Host(f'{{subdomain}}.{os.environ['TUNNEL_DOMAIN']}', app=proxy_app) 26 Host(f'{{subdomain}}.{os.environ['TUNNEL_DOMAIN']}', app=proxy_app)
22 ] 27 ]
23) 28)
24 29
30app.add_middleware(AuthenticationMiddleware, backend=BearerTokenAuthBackend())
31
25try: 32try:
26 from ._version import version 33 from ._version import version
27 __version__ = version 34 __version__ = version