favoritter/nfpm.yaml
Ole-Morten Duesund aa5ab6b415 fix: address code review findings for Phase 7-8
Bugs fixed:
- Renderer.Error set WriteHeader before Content-Type, causing
  the header to be silently dropped. Now sets Content-Type first.
- truncate template function operated on bytes, not runes — could
  split multi-byte UTF-8 characters (Norwegian æøå). Now uses
  []rune for correct Unicode handling.

Performance:
- Skip session DB lookup (2 queries) on /static/ and /uploads/
  requests — these never use user context.

UX consistency:
- Replace all http.NotFound and http.Error("Forbidden") in
  handler layer with styled error pages via Renderer.Error.
- Add notFound/forbidden helper methods on Handler.

Deployment fixes:
- Remove false libc6/glibc deps from nfpm.yaml (binary is
  statically linked with CGO_ENABLED=0).
- Add CGO_ENABLED=0 to Makefile build target for consistency.
- Add .dockerignore to exclude .git, dist/, data/ from build
  context.
- Remove phantom 'lint' from Makefile .PHONY.
- Document ProtectSystem=strict constraint in systemd service.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 16:39:10 +02:00

46 lines
1.2 KiB
YAML

# nfpm configuration for building .deb and .rpm packages.
# https://nfpm.goreleaser.com/
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# Usage:
# ARCH=amd64 VERSION=1.0.0 nfpm package --packager deb --target dist/
# ARCH=arm64 VERSION=1.0.0 nfpm package --packager rpm --target dist/
name: favoritter
arch: "${ARCH}"
platform: linux
version: "${VERSION}"
maintainer: "Ole M. <olemd@kode.naiv.no>"
description: "Self-hosted favorites web app"
vendor: ""
homepage: "https://kode.naiv.no/olemd/favoritter"
license: AGPL-3.0-or-later
contents:
- src: ./dist/favoritter_${VERSION}_linux_${ARCH}
dst: /usr/bin/favoritter
file_info:
mode: 0755
- src: ./dist/favoritter.service
dst: /lib/systemd/system/favoritter.service
- src: ./dist/favoritter.env
dst: /etc/favoritter/favoritter.env
type: config|noreplace
- dst: /var/lib/favoritter
type: dir
file_info:
mode: 0750
owner: favoritter
group: favoritter
- dst: /var/lib/favoritter/uploads
type: dir
file_info:
mode: 0750
owner: favoritter
group: favoritter
scripts:
postinstall: ./dist/postinstall.sh
preremove: ./dist/preremove.sh
# No runtime dependencies — binary is statically linked (CGO_ENABLED=0).