You must install the following to be able to run contribute with this repository:
- go
- docker
- docker-compose
We expect the following environment variables:
DB_NAME: Name of the database to connectDB_HOST: IP or Host of the database to connectDB_PORT: Port of the database to connectDB_USER: Username to connect to the databaseDB_PASSWORD: Password to connect to the databaseJWT_KEY: JWT key to be used
- In order to locally set this variables you can run the following command:
export DB_NAME=ot
export DB_HOST=127.0.0.1
export DB_PORT=3306
export DB_USER=tibia
export DB_PASSWORD=123123
export JWT_KEY="VHfw3zAaBdPC)zHAVevFadAad2VDkX)KGnD+vLRvjH*5IvbBhUk3Fkzte5jPIG"- Create the database and run the the API locally on port
3000
make local-initPS: Although you will be using port 3000 to test the API, it's actually using port 7474, but to speed up the development we are using a tool called gin that recompile our code everytime you save any go file and serve as a proxy.
-
Create new features or fix bugs Now you are free to develop with a simple local setup!
-
Run isolated tests
make test- Are you done? Destroy everything running:
make local-destroy
make test-destroyIf you are part of the frontend and wants to run this project locally you can simply run:
First set the environment variables:
export DB_NAME=ot
export DB_HOST=127.0.0.1
export DB_PORT=3306
export DB_USER=tibia
export DB_PASSWORD=123123
export JWT_KEY="VHfw3zAaBdPC)zHAVevFadAad2VDkX)KGnD+vLRvjH*5IvbBhUk3Fkzte5jPIG"Then, run docker compose:
docker-compose -f docker-compose-local.yaml up --buildThis will run the server on port 7474.
To shut down all the infrastructure just run:
docker-compose -f docker-compose-local.yaml downThis API server swagger on the following path: swagger/index.html if you want to see the webpage or /swagger/doc.json if you want the openapi specification JSON.