Add config package with build-tag-switched dev/prod environments, structured logging via zerolog, Taskfile for dev workflow, golangci-lint config, testutil package, and improved DB setup with proper SQLite pragmas and cleanup. Rename sqlc output package from gen to repository. Switch to allowlist .gitignore, Alpine+UPX+scratch Dockerfile, and CI pipeline with test/lint gates before deploy.
20 lines
471 B
Go
20 lines
471 B
Go
package config
|
|
|
|
import (
|
|
"github.com/rs/zerolog"
|
|
)
|
|
|
|
// LoadForTest sets config.Global to safe defaults without reading
|
|
// environment variables or .env files. Call this in TestMain or at the
|
|
// top of tests that import packages which depend on config.Global.
|
|
func LoadForTest() {
|
|
Global = &Config{
|
|
Environment: Dev,
|
|
Host: "127.0.0.1",
|
|
Port: "0",
|
|
LogLevel: zerolog.WarnLevel,
|
|
AppURL: "http://localhost:0",
|
|
DBPath: ":memory:",
|
|
}
|
|
}
|