Skip to content

Commit

Permalink
🐛 Add support for docker secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Paillat-dev committed Jun 20, 2024
1 parent e31c8b2 commit f6ca242
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
# auth with a bearer api key, whose hash is stored in the environment variable API_KEY_HASH
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
API_KEY_HASH = os.getenv("API_KEY_HASH")
assert API_KEY_HASH, "API_KEY_HASH environment variable must be set"
if not API_KEY_HASH and os.path.exists("/run/secrets/api_key_hash"):
with open("/run/secrets/api_key_hash", "r") as f:
API_KEY_HASH = f.read().strip()

assert API_KEY_HASH, "API_KEY_HASH must be set"

classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")

Expand Down

0 comments on commit f6ca242

Please sign in to comment.