import favicons into all **.ily.rs sites
This commit is contained in:
parent
4699453cf6
commit
554a268369
11 changed files with 45 additions and 0 deletions
18
modules/favicons.nix
Normal file
18
modules/favicons.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ ... }:
|
||||
let
|
||||
faviconRoot = ../assets/favicons;
|
||||
in
|
||||
{
|
||||
services.caddy.extraConfig = ''
|
||||
(favicons) {
|
||||
@favicon path /favicon.ico /favicon.svg /favicon.png /apple-touch-icon.png /apple-touch-icon-precomposed.png
|
||||
handle @favicon {
|
||||
root * ${faviconRoot}
|
||||
@needs_png path /favicon.ico /apple-touch-icon.png /apple-touch-icon-precomposed.png
|
||||
rewrite @needs_png /favicon.png
|
||||
header Cache-Control "public, max-age=86400"
|
||||
file_server
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
@ -176,11 +176,13 @@ in
|
|||
${site.domain}.extraConfig =
|
||||
if site.caddyConfig != null then site.caddyConfig
|
||||
else if site.static then ''
|
||||
import favicons
|
||||
root * ${site.dataDir}/repo/${site.buildOutputDir}
|
||||
encode zstd gzip
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
'' else ''
|
||||
import favicons
|
||||
reverse_proxy localhost:${toString site.port}
|
||||
encode zstd gzip
|
||||
'';
|
||||
|
|
@ -193,6 +195,8 @@ in
|
|||
) cfg) ++ (mapAttrsToList (name: site:
|
||||
let previewDataDir = "/srv/${name}-preview"; in {
|
||||
${site.preview.domain}.extraConfig = if site.static then ''
|
||||
import favicons
|
||||
|
||||
@health path /health-ping
|
||||
handle @health {
|
||||
respond 200
|
||||
|
|
@ -205,6 +209,8 @@ in
|
|||
file_server
|
||||
}
|
||||
'' else ''
|
||||
import favicons
|
||||
|
||||
@health path /health-ping
|
||||
handle @health {
|
||||
respond 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue