Stage 1: project skeleton, SQLite, migrations, HTTP server

- go mod init with chi, modernc.org/sqlite, golang.org/x/crypto
- Custom embedded migration runner (no CGO dependency)
- Config from TERDUT_ADDR / TERDUT_DB_PATH env vars
- chi router with /healthz endpoint
- Graceful shutdown on SIGINT/SIGTERM
This commit is contained in:
Niklas Ye
2026-05-20 21:41:40 +02:00
parent 5f458868b0
commit 0387e1e017
7 changed files with 253 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
package config
import "os"
type Config struct {
Addr string
DBPath string
}
func Load() Config {
addr := os.Getenv("TERDUT_ADDR")
if addr == "" {
addr = ":8080"
}
dbPath := os.Getenv("TERDUT_DB_PATH")
if dbPath == "" {
dbPath = "terdut.db"
}
return Config{Addr: addr, DBPath: dbPath}
}