Prerequisites
Before setting up Boiler-Go, ensure you have the following installed:- Go 1.21 or higher
- Docker and Docker Compose
- golang-migrate CLI tool
- sqlc for generating type-safe Go code from SQL
Clone the repository
First, clone the Boiler-Go repository:Environment configuration
Create a.env file in the root directory by copying the example file:
.env.example file contains all necessary environment variables:
Configuration options
Server configuration
Server configuration
APP_PORT: The port on which the API server will run (default: 8080)
Database configuration
Database configuration
DATABASE_URL: PostgreSQL connection string with formatpostgres://user:password@host:port/database?sslmode=disable
Redis configuration
Redis configuration
REDIS_ADDR: Redis server address (default: localhost:6379)REDIS_PASSWORD: Redis password (leave empty if no password)REDIS_DB: Redis database number (default: 0)
Timeout configuration
Timeout configuration
HEALTH_CHECK_TIMEOUT: Timeout for health check endpointsAPI_SHUTDOWN_TIMEOUT: Graceful shutdown timeout for API serverWORKER_SHUTDOWN_TIMEOUT: Graceful shutdown timeout for background workers
Logging configuration
Logging configuration
LOG_OUTPUT: Where logs should be written (stdout,file, orboth)LOG_FILE: Path to log file (required whenLOG_OUTPUTisfileorboth)