Initial commit
This commit is contained in:
1 parent
7af116d38d
commit
6388a63787
2 files changed
+21
No files matched your search
@@ -0,0 +1,10 @@
|
||||
from fastapi import FastAPI, Response
|
||||
from prometheus_client import generate_latest, CONTENT_TYPE_LATEST, Counter
|
||||
|
||||
metrics_api = FastAPI(title="Metrics Server", description="Prometheus metrics endpoint")
|
||||
|
||||
REQUEST_COUNTER = Counter("http_requests_total", "Total HTTP Requests", ["method", "endpoint", "status"])
|
||||
|
||||
@metrics_api.get("/metrics")
|
||||
async def metrics():
|
||||
return Response(generate_latest(), media_type=CONTENT_TYPE_LATEST)
|
||||
@@ -0,0 +1,11 @@
|
||||
from argon2 import PasswordHasher
|
||||
|
||||
ph = PasswordHasher()
|
||||
|
||||
|
||||
def verify_api_key(api_key: str, hashed: str) -> bool:
|
||||
try:
|
||||
return ph.verify(hashed, api_key)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
Reference in new issue
Block a user