Give inventory api key in request
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-08-02 00:32:17 +03:00
parent 0fd17b7cbb
commit e496cddcf5
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import os
app = Sanic(__name__) app = Sanic(__name__)
monitor(app).expose_endpoint() monitor(app).expose_endpoint()
INVENTORY_API_KEY = os.environ["INVENTORY_API_KEY"]
DOORBOY_SECRET_FLOOR = os.environ["DOORBOY_SECRET_FLOOR"] DOORBOY_SECRET_FLOOR = os.environ["DOORBOY_SECRET_FLOOR"]
DOORBOY_SECRET_WORKSHOP = os.environ["DOORBOY_SECRET_WORKSHOP"] DOORBOY_SECRET_WORKSHOP = os.environ["DOORBOY_SECRET_WORKSHOP"]
CARD_URI = os.environ["CARD_URI"] CARD_URI = os.environ["CARD_URI"]
@ -43,7 +44,10 @@ async def view_doorboy_uids(request):
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
r = await client.post(CARD_URI, json={ r = await client.post(CARD_URI, json={
"groups": [group] "groups": [group]
}, headers={"Content-Type": "application/json"}) }, headers={
"Content-Type": "application/json",
"Authorization": f"Basic {INVENTORY_API_KEY}"
})
j = r.json() j = r.json()
allowed_uids = [] allowed_uids = []
for obj in j: for obj in j:

View File

@ -24,6 +24,7 @@ services:
doorboy_proxy: doorboy_proxy:
network_mode: host network_mode: host
environment: environment:
INVENTORY_API_KEY: "sptWL6XFxl4b8"
DOORBOY_SECRET_FLOOR: "0123456789" DOORBOY_SECRET_FLOOR: "0123456789"
DOORBOY_SECRET_WORKSHOP: "9999999999" DOORBOY_SECRET_WORKSHOP: "9999999999"
FLOOR_ACCESS_GROUP: "k-space:floor" FLOOR_ACCESS_GROUP: "k-space:floor"