From 3f8841faeb5ebf430feba9878a46b41cbd93c015 Mon Sep 17 00:00:00 2001 From: Clifton Palmer Date: Mon, 28 Aug 2023 04:41:21 -0500 Subject: [PATCH 1/1] Added FQDN override for compose file --- docker-compose.yml | 2 ++ lua/dump_files.lua | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d46102e..e793fa4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,11 @@ services: - ${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 + - PUBLIC_FQDN_OVERRIDE=https://public.purplebirdman.com ports: - 80:80 volumes: diff --git a/lua/dump_files.lua b/lua/dump_files.lua index 4f98bcb..714029e 100644 --- a/lua/dump_files.lua +++ b/lua/dump_files.lua @@ -27,12 +27,19 @@ function handle(r) r.content_type = "text/plain" if r.method == 'GET' then + -- get all local symlinks 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( - filepath:gsub(r.document_root, r.server_name .. ":" ..r.port) + filepath:gsub(r.document_root, fqdn) )) end else -- 2.47.2