Files
terdut-server/internal/config/config.go
T
Niklas Ye 0387e1e017 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
2026-05-20 21:41:40 +02:00

21 lines
304 B
Go

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}
}