findy-agent-vault
Vault provides both
- Data storage service for findy-agency clients
- Abstraction/Convenience layer for agency protocol APIs which can be used through GraphQL interface.
Vault provides currently only a GraphQL API but intends to support also GRPC in the future. As a findy-agency client you can use also the findy-agent GRPC APIs directly, but will have to implement possible data storing and indexing capabilities yourself.
Setup development environment
Basic setup
-
Install golang
-
Run app
go run . version
You shoud see something similar to this:
I0526 14:43:44.750568 50912 config.go:68] Configuration file was not found, using environment/default variables only
Vault version dev
Service configuration
Vault cannot function without a working installation of core agency. Either setup core agency to your local machine or use agency installation in the cloud.
-
Vault can be configured using configuration file or environment variables. Following settings are required when running vault locally (note "<>" indicates example value, and should be replaced):
# core agency address
export FAV_AGENCY_HOST="<agency.example.com>"
# core agency port
export FAV_AGENCY_PORT="<50051>"
# path to agency grpc cert files
export FAV_AGENCY_CERT_PATH="<.github/workflows/cert>"
# true if this vault is the primary vault for the agency installation
export FAV_AGENCY_MAIN_SUBSCRIBER=false
# common agency JWT secret
export FAV_JWT_KEY="<jwt-secret-common-with-core>"
# vault database password (any password)
export FAV_DB_PASSWORD="<password-for-postgres>"
# vault server port
export FAV_SERVER_PORT=8085
# true if graphQL playground should be served in service root
export FAV_USE_PLAYGROUND=true
-
Vault uses postgres to store its data. You can start postgres in a docker container:
make db
-
Start vault by running the app with no arguments
go run .
Unit testing
Unit tests assume postgres is running on port 5433.
Launch default postgres container by declaring password for postgres user:
export FAV_DB_PASSWORD="mysecretpassword"
and running
make init-test
You can run all unit tests with command
go test ./...
For linting, you need to install golangci-lint
make check
builds, tests and lints the code.
Other documentation
Check docs-folder