koopa-admin-log/scripts/dossiers-ngi/caddy-dossiers-ngi.snippet

44 lines
1.3 KiB
Text

# Stanza body for dossiers.ngi.hacktivism.ch only (hand-check / re-seed).
# Apply on koopa (host-local):
# bash ~/bin/apply-dossiers-ngi-edition-switch.sh
# sudo ~/bin/caddy-apply
#
# Sticky bar switches build via cookie tdpd_edition → editions/<name>/.
# Stock Caddy only (templates + map + handle). No replace-response plugin.
# Keep .2 / .3 blocks untouched.
#
# Site-block body (no outer braces):
header Alt-Svc "clear"
@use path_regexp use ^/_cascade/use/([A-Za-z0-9_-]+)/?$
handle @use {
header Set-Cookie "tdpd_edition={re.use.1}; Path=/; Max-Age=31536000; SameSite=Lax"
redir * / 302
}
handle /_cascade/* {
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
file_server
}
handle /branch-status.json {
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
file_server
}
# Dynamic editions: cookie value is the dir name under editions/
# (hourly builder stages every origin/* tip as slug with / → -).
map {http.request.cookie.tdpd_edition} {edition_dir} {
default flask
flask flask
~^[A-Za-z0-9_-]+$ {http.request.cookie.tdpd_edition}
}
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch/editions/{edition_dir}
templates {
mime text/html
between "{%" "%}"
root /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
}
file_server
try_files {path} {path}/ {path}/index.html