]> Untitled Git - public.git/commitdiff
Added FQDN override for compose file
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Mon, 28 Aug 2023 09:41:21 +0000 (04:41 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Mon, 28 Aug 2023 09:41:21 +0000 (04:41 -0500)
docker-compose.yml
lua/dump_files.lua

index d46102eae9fe05793d18ccc80bd797609c3e4f1d..e793fa48b9f6e7a20f4708c7becff68ef151f479 100644 (file)
@@ -7,9 +7,11 @@ services:
         - ${SHARE_ROOT}:/storage
         - public_data:/usr/local/apache2/htdocs
         - httpd_users:/usr/local/apache2/auth
         - ${SHARE_ROOT}:/storage
         - public_data:/usr/local/apache2/htdocs
         - httpd_users:/usr/local/apache2/auth
+        - ./lua:/usr/local/apache2/lua
         environment:
         - PUBLIC_ROOT_DIR=/storage
         - PUBLIC_LINK_DIR=/usr/local/apache2/htdocs
         environment:
         - PUBLIC_ROOT_DIR=/storage
         - PUBLIC_LINK_DIR=/usr/local/apache2/htdocs
+        - PUBLIC_FQDN_OVERRIDE=https://public.purplebirdman.com
         ports:
         - 80:80
 volumes:
         ports:
         - 80:80
 volumes:
index 4f98bcb5b953ddc1bda98f8c5f35f87f94c45f33..714029e3d5424a23803bcb3564a7aa010d8bdcfa 100644 (file)
@@ -27,12 +27,19 @@ function handle(r)
     r.content_type = "text/plain"
 
     if r.method == 'GET' then
     r.content_type = "text/plain"
 
     if r.method == 'GET' then
+        -- get all local symlinks
         local links = {}
         dump_files(links, r, r.document_root)
 
         local links = {}
         dump_files(links, r, r.document_root)
 
+        -- if FQDN override is set,
+        -- use override instead of my own server name and port number
+        local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
+        fqdn = fqdn or r.server_name .. ":" ..r.port
+
+        -- print each link
         for filepath, info in pairs(links) do
             r:puts( ("%s\n"):format(
         for filepath, info in pairs(links) do
             r:puts( ("%s\n"):format(
-                filepath:gsub(r.document_root, r.server_name .. ":" ..r.port)
+                filepath:gsub(r.document_root, fqdn)
             ))
         end
     else
             ))
         end
     else