diff options
Diffstat (limited to 'ttun_server/__init__.py')
| -rw-r--r-- | ttun_server/__init__.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/ttun_server/__init__.py b/ttun_server/__init__.py index 388dd9e..6e1eabf 100644 --- a/ttun_server/__init__.py +++ b/ttun_server/__init__.py | |||
| @@ -3,7 +3,7 @@ import os | |||
| 3 | 3 | ||
| 4 | from fastapi import FastAPI | 4 | from fastapi import FastAPI |
| 5 | from starlette.middleware.authentication import AuthenticationMiddleware | 5 | from starlette.middleware.authentication import AuthenticationMiddleware |
| 6 | from starlette.routing import Host, Route, WebSocketRoute, Mount | 6 | from starlette.routing import Host, Mount, Route, WebSocketRoute |
| 7 | 7 | ||
| 8 | from authentication.backend import BearerTokenAuthBackend | 8 | from authentication.backend import BearerTokenAuthBackend |
| 9 | from authentication.endpoints import authentication, oauth | 9 | from authentication.endpoints import authentication, oauth |
| @@ -12,20 +12,20 @@ from proxy import app as proxy_app | |||
| 12 | from ttun_server.endpoints import health | 12 | from ttun_server.endpoints import health |
| 13 | from ttun_server.websockets import tunnel | 13 | from ttun_server.websockets import tunnel |
| 14 | 14 | ||
| 15 | logging.basicConfig(level=getattr(logging, os.environ.get('LOG_LEVEL', 'INFO'))) | 15 | logging.basicConfig(level=getattr(logging, os.environ.get("LOG_LEVEL", "INFO"))) |
| 16 | 16 | ||
| 17 | app = FastAPI( | 17 | app = FastAPI( |
| 18 | debug=True, | 18 | debug=True, |
| 19 | routes=[ | 19 | routes=[ |
| 20 | Mount('/management/', app=management), | 20 | Mount("/management/", app=management), |
| 21 | Mount('/auth/', app=authentication), | 21 | Mount("/auth/", app=authentication), |
| 22 | Mount('/oauth/', app=oauth), | 22 | Mount("/oauth/", app=oauth), |
| 23 | WebSocketRoute( | 23 | WebSocketRoute( |
| 24 | '/tunnel/', | 24 | "/tunnel/", |
| 25 | endpoint=tunnel, | 25 | endpoint=tunnel, |
| 26 | ), | 26 | ), |
| 27 | Route('/health/', endpoint=health), | 27 | Route("/health/", endpoint=health), |
| 28 | Host(f'{{subdomain}}.{os.environ['TUNNEL_DOMAIN']}', app=proxy_app) | 28 | Host(f"{{subdomain}}.{os.environ['TUNNEL_DOMAIN']}", app=proxy_app), |
| 29 | ], | 29 | ], |
| 30 | ) | 30 | ) |
| 31 | 31 | ||
| @@ -33,6 +33,7 @@ app.add_middleware(AuthenticationMiddleware, backend=BearerTokenAuthBackend()) | |||
| 33 | 33 | ||
| 34 | try: | 34 | try: |
| 35 | from ._version import version | 35 | from ._version import version |
| 36 | |||
| 36 | __version__ = version | 37 | __version__ = version |
| 37 | except ImportError: | 38 | except ImportError: |
| 38 | __version__ = 'development' | 39 | __version__ = "development" |
