TWHelp core code repository.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Dawid Wysokiński 4c31c4a12f
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
chore: downgrade to v1.3.3
23 hours ago
build/docker/twhelp chore(deps): update golang docker tag to v1.20.2 (#198) 2 weeks ago
cmd/twhelp refactor: rename fn -> f, loadJSONFile -> readJSONFile 4 weeks ago
docs chore: update (#141) 3 months ago
internal chore: downgrade to v1.3.3 23 hours ago
k8s feat: api - set DB_CONNECTION_MAX_LIFETIME to 30m [skip ci] 1 month ago
.commitlintrc.yml init 8 months ago
.dockerignore chore: update .dockerignore 6 months ago
.drone.yml chore: update deps 24 hours ago
.envrc init 8 months ago
.gitignore init 8 months ago
.golangci.yml chore(deps): update module to v1.51.2 4 weeks ago
.pre-commit-config.yaml chore: update deps 24 hours ago
LICENSE init 8 months ago
Makefile fix: player/tribe snapshot - clean up data only when Special = false 3 months ago chore: update (#141) 3 months ago
go.mod chore: downgrade to v1.3.3 23 hours ago
go.sum chore: downgrade to v1.3.3 23 hours ago
renovate.json chore: add skip ci to renovate [skip ci] 1 month ago
skaffold.yml chore: skaffold - run make generate before image build 3 months ago


TWHelp is a project aiming to provide:

  1. Easy access to Tribal Wars data, for both users and developers.
  2. Scripts & tools to facilitate gameplay.

Getting started


Setting up the environment


  1. Go (>= 1.19)
  2. Node.js (LTS, needed for commitlint)
  3. Kubernetes (>= 1.25.0)
    1. minikube
    2. Docker Desktop
  4. Docker CLI
  5. Skaffold
  6. pre-commit
  7. IDE/Code editor (e.g. Goland, VSCode, vim, neovim)
  8. direnv (optional, but recommended)
# if you have direnv installed
direnv allow

# install git hooks and required tools
make install

# run all required services
skaffold run --port-forward=true --tail=true

# stop all of them
skaffold delete

Running unit tests

At least one of the following is required to run unit tests:

  • Docker (dockertest will spin up a database)
  • Postgres database
# Docker
go test -v ./...

# Postgres database
TESTS_DB_DSN=postgres://twhelp:twhelp_pass@ go test -v ./... 

Creating a new database migration

# create a migration
go run ./cmd/twhelp/main.go db create go migration 1


Configuration options

Configuration options can be specified via environment variables.

Env variable Default Description
APP_MODE development Whether to use development or production settings
DB_DSN Required. Only Postgres is supported. Example: postgres://user:password@host:5432/dbname?sslmode=disable (
DB_MAX_OPEN_CONNECTIONS 5 Maximum number of open connections to the database (
DB_MAX_IDLE_CONNECTIONS 2 Maximum number of connections in the idle connection pool (
DB_CONNECTION_MAX_LIFETIME 3m Maximum amount of time a connection may be reused (
AMQP_URI Required. Example: amqp://user:password@host:5672/ (
API_SWAGGER_ENABLED false Enables the API documentation endpoints (e.g. /api/v1/swagger/index.html, /api/v1/swagger/doc.json)
API_SWAGGER_HOST Host (name or ip) serving the API (e.g.
API_SWAGGER_SCHEMES http,https Comma-separated list of protocols
API_CORS_ENABLED false Enables CORS headers
API_CORS_ALLOWED_ORIGINS Comma-separated list of allowed domains
API_CORS_ALLOW_CREDENTIALS false Whether requests with credentials are allowed
API_CORS_ALLOWED_METHODS HEAD,GET Comma-separated list of allowed methods
API_CORS_MAX_AGE 300 Max time to cache response (seconds)


Distributed under the MIT License. See LICENSE for more information.


Dawid Wysokiński -