-
Release v1.0.0 Stable
released this
2026-06-02 13:08:33 -06:00 | 0 commits to main since this releasev1.0.0
code.nochebuena.dev/einherjar/spa-server
Architecture Decisions Resolved
Decision Outcome Module type Binary, not a library — produces a Docker base image; no consumer imports webdependencyExcluded — plain net/http+coreis sufficient; chi routing and middleware add no value for static file servingSPA fallback http.Dir.Openpath sanitisation check before serving — prevents directory traversal without an extra dependencyDirectory listing Disabled — directory paths fall through to index.html; the SPA router owns all URL spaceHealth format Matches web/health.Responsewire format ({"status":"UP","components":{}}) without importingwebHealth status Always UP— no external dependencies to probe; process reachability is the only meaningful checkPort binding Synchronous in OnStartvianet.Listenbefore the goroutine — port conflicts surface immediatelyConfig parsing os.Getenvwith inline defaults — zero external dependencies, no caarlos0/env in the binaryBase image alpine:3.21withca-certificates+tzdata— consistent with the rest of the iron-dough ecosystemStatic dir default /srv/www— consumer Dockerfile doesCOPY dist/ /srv/www/with no env var override needed
API
import spaserver "code.nochebuena.dev/einherjar/spa-server" // Config type Config struct { Port int // EINHERJAR_SPA_PORT (default: 8080) StaticDir string // EINHERJAR_SPA_STATIC_DIR (default: /srv/www) } func DefaultConfig() Config // Server — implements lifecycle.Component type Server struct { /* unexported fields */ } func NewServer(logger logging.Logger, cfg Config) *Server func (s *Server) OnInit() error func (s *Server) OnStart() error func (s *Server) OnStop() error
Docker image
code.nochebuena.dev/einherjar/spa-server:v1.0.0 code.nochebuena.dev/einherjar/spa-server:latestBuild args:
VERSION— embedded at build time via-ldflags(default:dev)
Dependencies
Module Version Role code.nochebuena.dev/einherjar/contractsv1.0.0 lifecycle.Component,logging.Loggercode.nochebuena.dev/einherjar/corev1.0.0 launcher,logzDownloads