caddy: handle /contact and /blog
This commit is contained in:
parent
1d0edddc9e
commit
47d1ba611b
|
@ -75,7 +75,7 @@
|
|||
};
|
||||
|
||||
apps = {
|
||||
e11sync-caddyfile = {
|
||||
e11sync-caddy = {
|
||||
type = "app";
|
||||
name = "e11sync-caddyfile";
|
||||
program = toString (pkgs.writeShellScript "wrapper" ''
|
||||
|
|
|
@ -6,10 +6,15 @@
|
|||
writeTextFile {
|
||||
name = "e11sync-caddyfile";
|
||||
text = ''
|
||||
@addSlash path /static /blog /contact
|
||||
route @addSlash {
|
||||
redir {uri}/ 302
|
||||
}
|
||||
|
||||
header /static/* Cache-Control "public, max-age=31536000, immutable"
|
||||
|
||||
route /static/* {
|
||||
uri strip_prefix /static
|
||||
@staticRoutes path /static/* /contact/* /blog/*
|
||||
route @staticRoutes {
|
||||
file_server * {
|
||||
root ${e11sync-static}
|
||||
precompressed br gzip
|
||||
|
|
|
@ -13,22 +13,20 @@ runCommand "e11sync-static" {
|
|||
} ''
|
||||
unpackPhase
|
||||
|
||||
# check that {e11sync-djangostatic,e11sync-blog/static/style.*.css
|
||||
# is the same file
|
||||
hash1=$(echo e11sync-djangostatic/static/style.*.css | sed 's;.*/;;' )
|
||||
hash2=$(echo e11sync-blog/static/style.*.css | sed 's;.*/;;' )
|
||||
|
||||
if [ "$hash1" != "$hash2" ]; then
|
||||
{
|
||||
echo "style.*.css in blog and django do not match:"
|
||||
ls e11sync-djangostatic/style/style.*.css
|
||||
ls blog/style/style.*.css
|
||||
} >&2
|
||||
if ! cmp \
|
||||
e11sync-djangostatic/style.*.css \
|
||||
e11sync-blog/static/style.*.css
|
||||
then
|
||||
echo "style.*.css in blog and djangostatic do not match:"
|
||||
ls -l e11sync-djangostatic/style/style.*.css blog/style/style.*.css
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm e11sync-djangostatic/style.*.css
|
||||
|
||||
mkdir -p $out
|
||||
mv e11sync-djangostatic/* $out/
|
||||
mv --no-clobber e11sync-blog/{static,blog,contact} $out/
|
||||
mv e11sync-blog/{static,blog,contact} $out/
|
||||
mv --no-clobber e11sync-djangostatic/* $out/static/
|
||||
|
||||
find $out \
|
||||
-name '*.css' -or \
|
||||
|
|
Loading…
Reference in New Issue