]> Untitled Git - public.git/commitdiff
Updated publish with FQDN override 1.2.1
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Mon, 28 Aug 2023 09:49:53 +0000 (04:49 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Mon, 28 Aug 2023 09:49:53 +0000 (04:49 -0500)
docker-compose.yml
lua/publish.lua

index e793fa48b9f6e7a20f4708c7becff68ef151f479..96979c937fe42b33c1ab0140b79c6fce937a8081 100644 (file)
@@ -11,7 +11,7 @@ services:
         environment:
         - PUBLIC_ROOT_DIR=/storage
         - PUBLIC_LINK_DIR=/usr/local/apache2/htdocs
-        - PUBLIC_FQDN_OVERRIDE=https://public.purplebirdman.com
+#       - PUBLIC_FQDN_OVERRIDE=https://public.purplebirdman.com
         ports:
         - 80:80
 volumes:
index 5fa18c0785a80cacc0e0caf0d6f480ea6934f300..a132c709bb52e822361f6ce6bdd6fbef9840a254 100644 (file)
@@ -25,9 +25,13 @@ function handle(r)
 
     if pattern then
         local nonce = publish(r.context_document_root, pattern)
-        local uri = ("%s://%s:%s/%s"):format(
-            r.is_https and "https" or "http", 
-            r.server_name, r.port, nonce)
+
+        -- 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.is_https and "https" or "http") .. "://" .. r.server_name .. ":" ..r.port
+
+        local uri = ("%s/%s"):format(fqdn, nonce)
         r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
     else
         local template = get_form(r.context_document_root)