Skip to main content

Backend

Getting Started

  1. Install Rust from the official Website.

  2. Install a IDE for flutter Development. Recommended IDEs are VS Code or Rust Rover.

Dependencies

  • libpg
  • libsqlite3

Automatic recompile dependencies

  • systemfd cargo install systemfd
  • cargo-watch cargo install cargo-watch

Running the backend

Running the bot with automatic recompile

RUST_LOG=debug,tokio_postgres=info,sentry=info,hyper=info,reqwest=info ENGINE_DB_TYPE=sqlite SQLITE_URL=db.sqlite COMPONENTS_DIR=CSML/components \
systemfd --no-pid -s 3030 -- \
cargo watch -x "run -p hikari-server-- \
--global-cfg=$GLOBAL_CONFIG_PATH \
--config=$CONFIG_PATH \
--assessment=$ASSESSMENT_CONFIG_PATH \
--cookie-key=$COOKIE_KEY \
--csml-path=CSML \
--aud=$OIDC_CLIENT \
--oidc-client=$OIDC_CLIENT --oidc-key=$OIDC_KEY --oidc-issuer-url=$OIDC_ISSUER --oidc-redirect-url=\"$HOSTNAME/login/oidc/callback\""

Acquire login token

Navigate to http://localhost:3030/login/oidc in your browser

Note $RESPONSE_TOKEN from server log

Get an access token

curl -v -X POST -d "$RESPONSE_TOKEN" -H "Content-Type: application/json" "http://localhost:3030/login/token"

Execute queries

curl -v -H "Authorization: Bearer $ACCESS_TOKEN" -d '{"client": "test"}' -H "Content-Type: application/json" "http://localhost:3030/api/v0/bots/test/flows/*/trigger"