boyska 0d31b32429 http api to just check authentication status | пре 2 година | |
---|---|---|
.. | ||
pages | пре 2 година | |
static | пре 2 година | |
.gitignore | пре 2 година | |
Dockerfile | пре 2 година | |
README.md | пре 2 година | |
docker-compose.yaml | пре 3 година | |
pizzicore.env.sample | пре 2 година | |
pizzicore.py | пре 2 година | |
requirements.txt | пре 3 година |
Componente centrale del sistema pizzicaroli. tiene i conti. espone HTTP e WebSocket.
Alcune API richiedono autenticazione.
Il docker incluso è solo per comodità di sviluppo, non è strettamente necessario.
Il codice gestisce più di un contatore, per generalità, anche se non è chiaro se questa cosa ci servirà. I contatori partono da 0, quindi in genere useremo sempre 0.
Il sistema ha un suo storage, in modo che al riavvio i contatori ripartano da dove erano.
GET /counter/0
ti dà il valore
POST /counter/0/increment
incrementa, ma richiede basic-auth
/ws/counter/0
ti dà il valore e ti riaggiorna ogni volta che questo cambia. Ignora ogni messaggio in
ingresso.
docker-compose up
Just install a few packages from the standard repositories, and you're set. No pip, virtualenv, …
apt install python3-fastapi python3-dotenv uvicorn
env QUEUES_NUMBER=2 uvicorn pizzicore:app --reload --port 8000 --host 0.0.0.0
In the snippet above, you can see how to set variables on the commandline. See pizzicore.env.sample
for a list of settings.
You can also create a pizzicore.env
file (named exactly like that) as a configuration method.
Environment variables take precedence over configuration files.