Spaces:
Sleeping
Sleeping
Sneha Dixit commited on
Commit ·
561dc24
1
Parent(s): 097df9f
secrets check
Browse files- Dockerfile +4 -0
- server.py +4 -1
Dockerfile
CHANGED
|
@@ -6,4 +6,8 @@ WORKDIR /
|
|
| 6 |
|
| 7 |
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 6 |
|
| 7 |
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
| 8 |
|
| 9 |
+
# Get secrets
|
| 10 |
+
RUN --mount=type=secret,id=test,mode=0444,required=true \
|
| 11 |
+
cat /run/secrets/test > /test
|
| 12 |
+
|
| 13 |
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|
server.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI, Depends
|
|
|
|
| 2 |
import auth
|
| 3 |
|
| 4 |
app = FastAPI()
|
|
@@ -10,4 +11,6 @@ async def welcome():
|
|
| 10 |
@app.get("/generate")
|
| 11 |
async def generate(api_key = Depends(auth.api_key_auth)):
|
| 12 |
# add the logic to call gpt here
|
| 13 |
-
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, Depends
|
| 2 |
+
import os
|
| 3 |
import auth
|
| 4 |
|
| 5 |
app = FastAPI()
|
|
|
|
| 11 |
@app.get("/generate")
|
| 12 |
async def generate(api_key = Depends(auth.api_key_auth)):
|
| 13 |
# add the logic to call gpt here
|
| 14 |
+
os.environ.get('test')
|
| 15 |
+
response = os.environ.get('test')
|
| 16 |
+
return "All good. You only get this message if you're authenticated "+ response
|