]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Added feature for subfolder hosting
authorBernhard Großer <bernhard.grosser@gmail.com>
Mon, 21 Jun 2021 17:33:21 +0000 (19:33 +0200)
committerBastien Wirtz <bastien.wirtz@gmail.com>
Sat, 30 Apr 2022 08:46:00 +0000 (10:46 +0200)
By setting the SUBFOLDER env var, you can host Homer in a subfolder behind a reverse proxy.

README.md
entrypoint.sh

index 5ea80fb84575b865f964fe2fa69be5fe58c8fd98..57185a7614c53a21b0ca571b0b149b142c858a13 100644 (file)
--- a/README.md
+++ b/README.md
@@ -83,6 +83,10 @@ docker run -d \
 
 Default assets will be automatically installed in the `/www/assets` directory. Use `UID` and/or `GID` env var to change the assets owner (`docker run -e "UID=1000" -e "GID=1000" [...]`).
 
+## Host in subfolder
+
+If you would like to host Homer in a subfolder, for e.g. behind a reverse proxy, supply the name of subfolder by using the `SUBFOLDER` env var.
+
 ### Using docker-compose
 
 The `docker-compose.yml` file must be edited to match your needs.
index f1a8c229a38159d660f157d4ac089c2c7575cbd7..9da26151caf62cde53d79dd83d63347ee7804e45 100644 (file)
@@ -11,5 +11,11 @@ fi
 # Install default config if no one is available.
 yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null
 
+# Create symbolic link for hosting in subfolder.
+if [[ -n "${SUBFOLDER}" ]]; then
+  ln -s /www "/www/$SUBFOLDER"
+  chown -h $USER:$GROUP "/www/$SUBFOLDER"
+fi
+
 chown -R $UID:$GID /www/assets
 exec su-exec $UID:$GID darkhttpd /www/ --no-listing --port "$PORT"