Unrepeatable Protocol generator API in GO.
The PGen is a microservice created to generate service protocols for any type of services. These protocols are readable so that people can easily record
The protocol number consists of 16 digits (by default), the first 8 (fixed) being the current date and the last (configurable) random:
Format: 'YYYYMMDD????????' sample: 2021120912345678
- Gin - Go Web Framework
- Redis - KV NoSQL for Cache
- Testify - Asserts and Mocks
- Metrics - GinProm by Depado
- Clone de project:
git@github.com:gbzarelli/pgen.git
- Go to
pgen
directory:$cd pgen/
- Build project
- Prepare dependencies
$make dependencies
- Build project
$make build
- Prepare dependencies
- Generate Dockerfile
$make build-docker
- Run full stack:
$make run-docker-compose
- Run the dependencies (infra / redis):
$make run-docker-stack
- Run project
$go run main.go
Custom the decimal places value to generate a new protocol (default 8):
PROTOCOL_DECIMAL_PLACES_AFTER_DATE
- Default in Project and Dockerfile: 8
Custom Redis address:
REDIS_ADDRESS
- Default in Project: localhost:6379
- Default in Dockerfile: redis:6379
The project starts in localhost:5000
with a unique endpoint to generate a new protocol:
curl --request POST --url http://localhost:5000/v1/protocol
201 {"protocol": "2021121204066844"}
curl --request GET --url http://localhost:5000/metrics
If you run by docker just open prometheus in: http://localhost:9090/