Caddy takes nginx's place in compose: ports 80/443, the fixed address 172.28.255.251 that cloudflared pins the public names to, the network aliases, the healthcheck and the autoheal label. nginx and certbot are removed from compose; Caddy already holds its own certificates in ./caddy/data, obtained while it ran beside nginx. `traffic` now tails logs/caddy/payloads.log, and the dev override switches Caddy to its dev sites instead of putting nginx in DEV_MODE. Docs and comments that described nginx's behaviour now describe Caddy's: CLAUDE.md, DEPLOYMENT.md (topology, boot paths, TLS, rate limits, runbook with a rollback, rough edges), the READMEs, .env.example and the comments in the backend, Python service, Vue source and infra files. nginx/ and certbot/ stay in the repo as the rollback until this has settled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package graph
|
|
|
|
import "testing"
|
|
|
|
func TestValidateSlug(t *testing.T) {
|
|
for _, c := range []struct {
|
|
slug string
|
|
ok bool
|
|
}{
|
|
{"notes-to-self", true},
|
|
{"shrines/evangelion", true},
|
|
{"shrines/neon-genesis/rei2", true},
|
|
{"", false},
|
|
{"Shrines/GTO", false}, // upper case
|
|
{"shrines/", false}, // empty segment
|
|
{"/shrines/gto", false}, // leading slash
|
|
{"shrines//gto", false}, // empty segment
|
|
{"shrines/gto-", false}, // trailing hyphen
|
|
{"shrines/../admin", false}, // dots
|
|
{"shrines", true}, // the index is a canvas page too
|
|
{"shrines/demoman", true}, // no longer an SPA route
|
|
{"admin/pages", false}, // under an SPA route
|
|
{"jobs/x", false}, // under a Caddy route
|
|
{"stp", true}, // the home page is a canvas page too
|
|
{"stp2", false}, // an SPA route
|
|
{"index", false}, // the landing canvas's key
|
|
{"stp-fan-page", true}, // only whole segments are reserved
|
|
} {
|
|
err := validateSlug(c.slug)
|
|
if (err == nil) != c.ok {
|
|
t.Errorf("validateSlug(%q) = %v, want ok=%v", c.slug, err, c.ok)
|
|
}
|
|
}
|
|
}
|