From 49c73b14d4ac0078a5bd7f641a9dff65b0fc2c51 Mon Sep 17 00:00:00 2001
From: Anusha Ranganathan <anusha@cottagelabs.com>
Date: Thu, 27 Apr 2023 12:21:52 +0100
Subject: [PATCH] Read host from application url for persistent hostpath

---
 hyrax/config/initializers/hyrax.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hyrax/config/initializers/hyrax.rb b/hyrax/config/initializers/hyrax.rb
index 44cb7c1a..b5023c50 100644
--- a/hyrax/config/initializers/hyrax.rb
+++ b/hyrax/config/initializers/hyrax.rb
@@ -53,7 +53,7 @@ Hyrax.config do |config|
   # config.temp_file_base = '/home/developer1'
 
   # Hostpath to be used in Endnote exports
-  # config.persistent_hostpath = 'http://localhost/files/'
+  config.persistent_hostpath = "#{ENV['APPLICATION_URL'] || 'http://localhost'}/files/"
 
   # If you have ffmpeg installed and want to transcode audio and video set to true
   config.enable_ffmpeg = true
-- 
GitLab