The wallet provider requires a Postgres database, named wallet_provider. By
default it uses localhost with postgres as username and password. You can
change this via the settings file and/or scripts/.env for setup-devenv.sh.
To setup a local database using psql:
create database wallet_provider;
create database wallet_provider_audit_log;For running the database migrations:
DATABASE_URL="postgres://$DB_USERNAME:$DB_PASSWORD@$PGHOST:$PGPORT/wallet_provider" \
cargo run --bin wallet_provider_migrations -- fresh
DATABASE_URL="postgres://$DB_USERNAME:$DB_PASSWORD@$PGHOST:$PGPORT/wallet_provider_audit_log" \
cargo run --bin audit_log_migrations -- freshThis command drops all tables and runs all migrations.
Default settings are specified in src/settings.rs.
In order to override default settings, create a file named
wallet_provider.toml in the same location as wallet_provider.example.toml (
which can also be used as a starting point).
Alternatively, see the instructions for setting up a development environment in
the main README.md.
Default settings (in wallet_provider/src/settings.rs) and settings specified
in wallet_provider.toml can both be overriden by environment variables. All
environment variables should be prefixed with WALLET_PROVIDER__, e.g.
WALLET_PROVIDER__SIGNING_PRIVATE_KEY. Grouped settings can be specified as
follows: WALLET_PROVIDER__DATABASE__URL, where the group name is separated
from the key by a double underscore __.
Every time the database schema changes, the entities need to be regenerated. For
this we have created a script that uses the sea-orm-cli.
scripts/generate-db-entity.sh wallet_providerThere are database-specific integration test that can be run with:
cargo test --features db_testThere are HSM specific test that can be run with:
cargo test --features hsm_testDuring local development, the Wallet Provider can be run with the following command:
RUST_LOG=debug cargo run --bin wallet_providerIf the log level is at least debug (as above), it will output the public keys that are derived from the private keys. This can then be used in development of the Wallet app.