b69c2e1e94
* move stats types from vpn-client to here * base stats api * change storage schema * add link to nymAPI for whitelisting * remove outdated comment * more comments update * example of chrono vs time * Add build.rs - exports DATABASE_URL so cargo check works - exports SQLX_OFFLINE for CI - added pg_up.sh which spawns PG container - required for cargo sqlx prepare * fixes time vs chrono issue and cleaner build with docker * add correct swagger types, with feature locking where relevant * apply dynco suggestions --------- Co-authored-by: dynco-nym <173912580+dynco-nym@users.noreply.github.com>
1.1 KiB
1.1 KiB
Nym-statistics-api
A simple API to collect and store statistics sent by nym-vpn-client.
Build instructions
The statistics API is backed by a PostgreSQL database so you'll need a PostgreSQL server running if you want to add migrations or add/modify SQL queries. I recommend https://postgresapp.com on MacOS, very easy to use. If you're on another OS, it's up to you.
Assuming your database is running at postgresql://user:password@host:port/database_name you'll likely need to run the following :
DATABASE_URL="postgresql://user:password@host:port/database_name"
# if you don't have an existing datase
sqlx database create --database-url $DATABASE_URL
sqlx migrate run --database-url $DATABASE_URL
# reset it if you messed with migrations while developping
sqlx database reset --database-url $DATABASE_URL
# or just run new migrations
sqlx migrate run --database-url $DATABASE_URL
# then prepare queries for offline build mode
cargo sqlx prepare --database-url $DATABASE_URL
This should allow cargo build without having any postgreSQL server running.
Be sure to add the .sqlx directory to version control