fix: preview port assertion + simpler health-ping

This commit is contained in:
Lewis Wynne 2026-04-07 23:16:48 +01:00
parent 3cc870fe8f
commit 160bb60ee6
2 changed files with 8 additions and 5 deletions

View file

@ -4,7 +4,7 @@
extraConfig = ''
@health path /health-ping
handle @health {
reverse_proxy localhost:8070
respond 200
}
handle {

View file

@ -135,6 +135,11 @@ in
};
config = {
assertions = mapAttrsToList (name: site: {
assertion = site.static || site.preview.port != null;
message = "services.site.${name}.preview.port is required when static = false and preview is enabled";
}) previewCfg;
services.caddy.virtualHosts = mkMerge ((mapAttrsToList (name: site:
{
${site.domain}.extraConfig = if site.static then ''
@ -157,9 +162,7 @@ in
${site.preview.domain}.extraConfig = if site.static then ''
@health path /health-ping
handle @health {
root * ${previewDataDir}/repo/${site.buildOutputDir}
try_files {path} /index.html
file_server
respond 200
}
handle {
import tinyauth
@ -171,7 +174,7 @@ in
'' else ''
@health path /health-ping
handle @health {
reverse_proxy localhost:${toString site.preview.port}
respond 200
}
handle {
import tinyauth