fix: preview port assertion + simpler health-ping
This commit is contained in:
parent
3cc870fe8f
commit
160bb60ee6
2 changed files with 8 additions and 5 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
@health path /health-ping
|
@health path /health-ping
|
||||||
handle @health {
|
handle @health {
|
||||||
reverse_proxy localhost:8070
|
respond 200
|
||||||
}
|
}
|
||||||
|
|
||||||
handle {
|
handle {
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,11 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
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:
|
services.caddy.virtualHosts = mkMerge ((mapAttrsToList (name: site:
|
||||||
{
|
{
|
||||||
${site.domain}.extraConfig = if site.static then ''
|
${site.domain}.extraConfig = if site.static then ''
|
||||||
|
|
@ -157,9 +162,7 @@ in
|
||||||
${site.preview.domain}.extraConfig = if site.static then ''
|
${site.preview.domain}.extraConfig = if site.static then ''
|
||||||
@health path /health-ping
|
@health path /health-ping
|
||||||
handle @health {
|
handle @health {
|
||||||
root * ${previewDataDir}/repo/${site.buildOutputDir}
|
respond 200
|
||||||
try_files {path} /index.html
|
|
||||||
file_server
|
|
||||||
}
|
}
|
||||||
handle {
|
handle {
|
||||||
import tinyauth
|
import tinyauth
|
||||||
|
|
@ -171,7 +174,7 @@ in
|
||||||
'' else ''
|
'' else ''
|
||||||
@health path /health-ping
|
@health path /health-ping
|
||||||
handle @health {
|
handle @health {
|
||||||
reverse_proxy localhost:${toString site.preview.port}
|
respond 200
|
||||||
}
|
}
|
||||||
handle {
|
handle {
|
||||||
import tinyauth
|
import tinyauth
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue