Files
doorboy-proxy/README.md
Mykhailo Yermolenko e6fc5cb85f Add keep_open_until to /allowed for hold-door; fix 9 bugs
/allowed returns keep_open_until from the newest approved hold in
doorlog; /longpoll skips hold events to avoid spurious open pulses.

Fixes: assert->raise for SECRET check, text() on 403, remove dead
/logs code, flatten auth decorator, by_slackid None fallback, load
kube config once, guard missing slack command, backoff on PyMongoError,
mongo->mongosh.
2026-06-17 16:42:54 +03:00

2.0 KiB

Doors docs: https://wiki.k-space.ee/en/hosting/doors

Background

This component serves allowed list of keyfob UID hashes from MongoDB and pushes open door commands to door controllers.

Testing endpoints

For manually testing something like this might help:

curl -f http://127.0.0.1:5000/allowed -H "KEY: 0123456789"

Test scenarios

When updating doorboy proxy, members site or kdoorpi verify follwing:

  • Swiping unknown card shows up as unknown, it can be claimed on members site and it immediately can be used after claiming
  • Card enable/disable on members site works and has effect
  • Opening door via buttons at https://members.k-space.ee/m/doorboy works and has effect
  • Opening door via /open-ground-door, /open-front-door and /open-back-door commands in Slack channel #members works
  • Keep door open via members site works and has effect: submit a hold, verify /allowed returns keep_open_until, then verify cancel/expiry returns null.

When testing changes prefer using the back door and use a brick or something to keep it open to prevent interfering with other members entering and exiting.

Development

The easiest is to obtain VM from Proxmox cluster with public IP address. To run development instance:

docker-compose -f docker-compose.yml up --build

On kdoorpi override KDOORPI_API_ALLOWED, KDOORPI_API_LONGPOLL environment variables to redirect requests to your dev instance.

Deployment

Slack credentials

  1. https://api.slack.com/apps → Create new app → From scratch
  2. Verification Token as SLACK_VERIFICATION_TOKEN
  3. App home → Bot user
  • commands
  • users:read
  1. Add commands. Request URL https://doorboy-proxy.k-space.ee/slack-open
  2. Incoming Webhooks → assign to channel -> Webhook URL as SLACK_DOORLOG_CALLBACK

OIDC groups

Assumes k-space:floor and k-space:workshop, same in inventory-app.