Rust implementation of Montpellier Jug lottery (third version).
This implementation is a project to demonstrate the utilisation of several crates :
The application should run with the following env vars :
ORGANIZER_TOKEN
: Organization id in eventbriteEVENTBRITE_TOKEN
: Personal OAuth Token in eventbriteRUST_LOG
: Log level (example :info
)DATABASE_URL
: Database SQLite url (example :test.db
)
The databases migrations will be executed by the application on startup.
If you want to executed the migrations manually (to check your scripts) :
# DATABASE_URL env var is mandatory
cargo install diesel_cli # to install diesel command
diesel setup # initialize database if needed
diesel migration run
Needed packages for build:
libssl
libsqlite3
The application can be build in Docker Dockerfile : docker build -t lottery-jug-actix .
Run the application : docker run -e ORGANIZER_TOKEN=91672475603 -e EVENTBRITE_TOKEN=E7N7QDHSXM2V2YB6AC2I -p 8088:8088 lottery-jug-actix
The DATABASE_URL
is by default on /var/data/lottery-jug/lottery.db
.
The RUST_LOG
is be default set to info
.
GET
-> /winners?nb=X
Results :
200
:
[
{
"first_name": "Francois",
"last_name": "Teychene"
},
{
"first_name": "Jean-Luc",
"last_name": "Racine"
},
{
"first_name": "Renard",
"last_name": "Chenapan"
}
]
400
: Invalid parameter503
: No live events500
: Unxepected error
POST
-> /record
Body :
{
"first_name": "Francois",
"last_name": "Teychene"
}
Results :
200
:
{
"id": "b3f0182e-b2f4-47a2-9c6f-9ea3a67b588c",
"first_name": "Francois",
"last_name": "Teychene",
"event_id": "52097259305"
}
500
: Unexpected error