0387e1e017
- 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
21 lines
304 B
Go
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}
|
|
}
|