list env variables
Browse files- app/main.py +8 -0
app/main.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
from fastapi import FastAPI, WebSocket
|
2 |
from fastapi.responses import HTMLResponse
|
|
|
|
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
@@ -43,6 +45,12 @@ html = """
|
|
43 |
async def get():
|
44 |
return HTMLResponse(html)
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
@app.websocket("/ws")
|
48 |
async def websocket_endpoint(websocket: WebSocket):
|
|
|
1 |
from fastapi import FastAPI, WebSocket
|
2 |
from fastapi.responses import HTMLResponse
|
3 |
+
import os
|
4 |
+
|
5 |
|
6 |
app = FastAPI()
|
7 |
|
|
|
45 |
async def get():
|
46 |
return HTMLResponse(html)
|
47 |
|
48 |
+
@app.get("/env")
|
49 |
+
async def env():
|
50 |
+
environment_variables = "<h3>Environment Variables</h3>"
|
51 |
+
for name, value in os.environ.items():
|
52 |
+
environment_variables += f"{name}: {value}<br>"
|
53 |
+
return HTMLResponse(environment_variables)
|
54 |
|
55 |
@app.websocket("/ws")
|
56 |
async def websocket_endpoint(websocket: WebSocket):
|