fix(k8s): pass project context to km vectorize
This commit is contained in:
@@ -15,6 +15,14 @@ import sys
|
||||
import httpx
|
||||
|
||||
|
||||
def _project_headers() -> dict[str, str]:
|
||||
"""Return internal API project context headers required by fail-closed RLS."""
|
||||
project_id = os.environ.get("KM_PROJECT_ID", "awoooi").strip()
|
||||
if not project_id:
|
||||
project_id = "awoooi"
|
||||
return {"X-Project-ID": project_id}
|
||||
|
||||
|
||||
async def main() -> int:
|
||||
api_base = os.environ.get(
|
||||
"INTERNAL_API_URL",
|
||||
@@ -24,7 +32,7 @@ async def main() -> int:
|
||||
|
||||
async with httpx.AsyncClient(timeout=1800) as client:
|
||||
try:
|
||||
resp = await client.post(url)
|
||||
resp = await client.post(url, headers=_project_headers())
|
||||
print(f"embed-all: {resp.status_code} {resp.text[:200]}")
|
||||
if resp.status_code >= 400:
|
||||
print(f"ERROR: embed-all returned {resp.status_code}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user