Serve as a foundation upon which I can build future Go projects.
Since this project uses Go modules, ensure this repo is cloned outside your $GOPATH
.
Install these tools in addition to those for quick edits.
- Go installation matching .tool-versions
- Make
- Docker
- ag
- entr
To build and run the application, run these commands.
make deps
make clean dev
make clean
Changing any static file (e.g. HTML, SQL), run make embeds
.
A Postman collection is provided in build/postman. This can either be imported into Postman or run on the command line with Newman.
If you find any bugs or have any suggestions, please open an issue on GitHub. I will take pull requests for many things, but I will be more hesitant with new features.
For each PR, a test suite will run to ensure correctness. To see what commands it runs, see build/ci.
make release
This will generate static binaries for Mac and Linux and a Docker image.
Before running this, ensure you have a running Postgres server. If one is not provided, the process will crash. The main application runs on port 8000, and the metrics server is available on port 8001. Configuring those ports, log level, and database settings can be done via environment variables.
_All environment variables are prefixed with BASE_GO_
._
Variable | Default |
---|---|
APP_PORT | 8000 |
METRICS_PORT | 8001 |
LOG_LEVEL | info |
DB_HOST | 127.0.0.2 |
DB_PORT | 5432 |
DB_USER | postgres |
DB_SSLMODE | disable |
Valid values for LOG_LEVEL
include debug
, info
, warn
, error
, fatal
, and panic
.
Valid values for DB_SSLMODE
include the following.
disable
- No SSLrequire
- Always SSL (skip verification)verify-ca
- Always SSL (verify that the certificate presented by the server was signed by a trusted CA)verify-full
- Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)