Backend part of Better Stats for Killing Floor 2.
- MySQL 8.0+
- Go 1.21+
- Create
.env
based on.env.example
- Use
ip:port
format forSERVER_ADDR
(default port is 3000) - Fill MySQL variables.
- Set
SECRET_TOKEN
as random string. Used to protect POST endpoints called from the mutator. - Set
STEAM_API_KEY
from https://steamcommunity.com/dev/apikey. Used to show user avatars on frontend.
go build -o ./main.exe -a -ldflags '-linkmode external -extldflags "-static"' ./cmd/production
- Install air for live reload and swag to generate docs
go install github.com/cosmtrek/air@latest
go install github.com/swaggo/swag/cmd/swag@latest
swag init -g .\cmd\development\main.go
- Use air
air
NOTE:
Generated docs are available on http://localhost:3000/docs/index.html. You have to rerun swag init -g .\cmd\development\main.go
every time when api changes in order to see actual data.
- Complete Env step from Non-docker setup.
- Set
SERVER_ADDR
to0.0.0.0:3000
- Build using docker compose
docker compose up -d --build
- If changes were made run:
docker compose down
docker compose up -d --build