Auth service for the Ledger project. Handles user login and registration.
Copy config.example.yml
to config.yml
and fill in the appropriate values.
The sqlc library is used to generate Go functions based on provided queries.
Queries are placed in the sql/query
folder and generate code is in the internal/db
package.
To add a new query, add the query to the sql/query
folder. Then run the sqlc compile
command
to verify syntax. Finally, sqlc generate
will generate the Go code.
Tests are located in the tests package. These are integration tests that require a database connection.
There are two options to run tests:
Running in local environment:
go test ./...
Running with docker-compose:
make test
Install the migrate CLI.
Make sure the connection is setup in Makefile.
Migrate up:
make migrate
Migrate down:
make migrate-down
migrate create -ext sql -dir sql/migrations -seq <migration name>
The following command is an example of how to create a Vault PKI role with proper restrictions:
write intermediateca/roles/ledger-auth allow_localhost=false allowed_domains=ledger-auth,ledger-auth.ledger-auth allow_bare_domains=true enforce_hostnames=false key_type=ec key_bits=256