go-open-insurance
An implementation of the Brazil Open Insurance specifications in Go.
Open API Specs
The following Open Insurance Open API Specifications are implemented.
Phase 2
Phase 3
Usage and Development Guide
To ensure MockIn works correctly in your local environment, you need to update your system's hosts file (usually located at /etc/hosts on Unix-based systems or C:\Windows\System32\drivers\etc\hosts on Windows). This step allows your machine to resolve the required domains for MockIn.
127.0.0.1 mockin.local
127.0.0.1 matls-mockin.local
If you're running MockIn directly on your machine instead of in a Docker container, add this additional entry. It ensures MockIn can resolve the mocked directory served by the NGINX container:
127.0.0.1 directory
If you are developing or modifying this project, start by running make setup-dev
. For this you will need:
- Docker and Docker Compose installed.
- Go 1.22.x installed and properly configured in the development environment.
- Pre-commit installed for managing Git hooks.
jq
installed for JSON processing in the Makefile commands.
Once the setup is complete, you'll be able to use all other make commands.
If you only need to run the project without modifying it, you can use the simpler setup with make setup
. For this you only need Docker and Docker Compose installed. After this setup, you can start the services using make run
.
Dependencies
This project relies significantly on some Go dependencies that streamline development and reduce boilerplate code.
oapi-codegen
oapi-codegen is used for generating Go code based on the Open Insurance OpenAPI specifications. It simplifies the process of creating schemas, reducing the need to handle HTTP requests directly with the Go standard library.
We recommend reviewing the oapi-codegen documentation, particularly the section on Strict Server, which includes some examples.
The configurations for this module are located in tools/oapi-config.yml
.
go-oidc
go-oidc is a configurable OpenID provider written in Go. It handles OAuth-related functionalities, including authentication, token issuance, and scopes. Familiarity with this library's concepts is important for understanding the project's implementation of these aspects.
TODOs
- Update go-oidc version.
- Make mongo db remove expired records.
- Env. Defaults to DEV and log warning?
- Dynamic fields.
- Implement user session.
- Data generators.
- Business.
- Add more logs.
- Better way to generate the software statement assertion.