This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/attic-docker.git


The following commit(s) were added to refs/heads/main by this push:
     new a2e9213  Allow override of localhost
a2e9213 is described below

commit a2e921311c73e85dab6a48037a4a9b0b6d2d9183
Author: Sebb <s...@apache.org>
AuthorDate: Wed Mar 26 13:19:46 2025 +0000

    Allow override of localhost
---
 README.md               | 2 +-
 compose.yaml            | 3 +++
 config/attic_filter.lua | 6 ++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 0495ffa..d0f5c2a 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ the closer_cgi/files directory in the private 
infrastructure-p6 repository.
 If not available, such pages will fail to load, but the site should otherwise 
work OK.
 
 Start:
-`[VAR_DYN=/path/to/closer_cgi/files] VAR_HTML=/path/to/website docker compose 
up`
+`[VAR_DYN=/path/to/closer_cgi/files] VAR_HTML=/path/to/website 
VAR_NAME=sitename docker compose up`
 
 browse to localhost:8000
 
diff --git a/compose.yaml b/compose.yaml
index 7628999..12a6902 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -10,3 +10,6 @@ services:
       # Needs to match xxx.apache.org or closer.lua reverts to default template
       - ${VAR_HTML:-./www}:/var/www/site.apache.org
       - ${VAR_LOG:-./log}:/var/log/apache2
+    environment:
+      # Pass in site name
+      - VAR_NAME=${VAR_NAME:-localhost}
\ No newline at end of file
diff --git a/config/attic_filter.lua b/config/attic_filter.lua
index 25a0772..7964c3a 100644
--- a/config/attic_filter.lua
+++ b/config/attic_filter.lua
@@ -37,6 +37,12 @@ function output_filter(r)
     -- get TLP part of hostname
     local host = r.hostname:match("^([^.]+)")
 
+    -- Allow override of host name
+    if host == 'localhost'
+    then
+        host = os.getenv('VAR_NAME') or 'unknown'
+    end
+
     -- create the customised banner
     local divstyle = 
'font-size:x-large;padding:15px;color:white;background:red;z-index:99;' ;
     local astyle = 'color:white;text-decoration:underline' ;

Reply via email to