Server: - Add a --cache-path allowlist so a server can be limited to the caches it is meant to purge, defaulting to any path as before. - Set socket permissions explicitly (--socket-mode, default 0660) instead of inheriting the service manager's umask, which left the socket unreachable. - Refuse to remove a socket another instance is still serving. - Read keys both raw and decoded, so keys nginx stored with escapes and keys a caller escaped by hand both purge. - Add an exact= parameter for literal keys containing glob punctuation. - Report purge failures as 500 rather than 502, and send error bodies through http.Error so a failure is not reported as a successful purge. - Graceful shutdown with systemd readiness notification. Purge: - Group purge arguments into PurgeRequest and report the number of entries removed. - Compile exclude globs once, and fail the purge when one is invalid rather than purging the keys it was meant to keep. - Cap header scanning and tolerate entries nginx evicts mid-walk. - Switch to filepath.WalkDir to avoid an Lstat per cache file. New: - service command to install, start, stop, and remove the system service. - service install takes --cache-path, writing the allowlist into the unit it installs, so an installed service is restricted from its first start. - Makefile, VERSION, and build identifiers stamped via ldflags. - Tests for the server handler and the service command. Build: - Update to Go 1.25, kong v1, GoReleaser v2, and current GitHub Actions. - Add vet and test steps to CI. - Rename purgeCmd.go/serverCmd.go to Go's file naming convention. Bump version to 0.2.0.
74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
# GoReleaser config for nginx-cache-purge.
|
|
# https://goreleaser.com
|
|
#
|
|
# CGO is disabled so the binary is fully static (no glibc dependency) and runs
|
|
# unmodified across modern Linux distributions.
|
|
version: 2
|
|
|
|
project_name: nginx-cache-purge
|
|
|
|
before:
|
|
hooks:
|
|
- go mod tidy
|
|
- go test ./...
|
|
|
|
builds:
|
|
- id: nginx-cache-purge
|
|
main: .
|
|
binary: nginx-cache-purge
|
|
env:
|
|
- CGO_ENABLED=0
|
|
flags:
|
|
- -trimpath
|
|
# The build identifiers live in package main, so they are stamped there
|
|
# rather than in an imported configuration package.
|
|
ldflags:
|
|
- -s -w
|
|
- -X main.Version={{ .Version }}
|
|
- -X main.Commit={{ .ShortCommit }}
|
|
- -X main.Date={{ .Date }}
|
|
- -X main.Mode=release
|
|
goos:
|
|
- linux
|
|
- darwin
|
|
goarch:
|
|
- "386"
|
|
- amd64
|
|
- arm
|
|
- arm64
|
|
- ppc64le
|
|
goarm:
|
|
- "6"
|
|
ignore:
|
|
- goos: darwin
|
|
goarch: "386"
|
|
- goos: darwin
|
|
goarch: arm
|
|
- goos: darwin
|
|
goarch: ppc64le
|
|
|
|
archives:
|
|
- id: default
|
|
formats: [tar.gz]
|
|
# Kept compatible with the results of uname, matching the naming earlier
|
|
# releases were published under.
|
|
name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
|
|
wrap_in_directory: true
|
|
files:
|
|
- README.md
|
|
- LICENSE.txt
|
|
|
|
checksum:
|
|
name_template: "checksums.txt"
|
|
|
|
snapshot:
|
|
version_template: "{{ incpatch .Version }}-snapshot"
|
|
|
|
changelog:
|
|
use: git
|
|
sort: asc
|
|
filters:
|
|
exclude:
|
|
- "^docs:"
|
|
- "^test:"
|
|
- "^chore:"
|