diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-09 22:18:14 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-09 22:18:14 +0300 |
| commit | 05a8c2ba95ec9ed81898fa3545f36c96760b48df (patch) | |
| tree | b52c1fff12109dcebae57d0ff244126b6bb73bee /internal/api/server.go | |
| parent | adec17e01da2539d1b1826148e77993d5e3271b5 (diff) | |
internal/api: panic early in NewServerWithLogger if Config is nil
Prevents nil dereference panics in handlers that unconditionally
access s.cfg (share, media, auth). Fail-fast at wiring time matches
project convention.
Diffstat (limited to 'internal/api/server.go')
| -rw-r--r-- | internal/api/server.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/api/server.go b/internal/api/server.go index 0ec9a46..559cb1f 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -69,6 +69,9 @@ func NewServer(deps ServerDeps) *Server { // NewServerWithLogger creates a Server with routes and an injected logger. func NewServerWithLogger(deps ServerDeps, logger *slog.Logger) *Server { + if deps.Config == nil { + panic("api.NewServerWithLogger: Config is nil") + } if deps.StaticFS == nil { deps.StaticFS = http.Dir("web") } |
