Skip to content

Commit

Permalink
Add ability to configure vips_tmp_directory location
Browse files Browse the repository at this point in the history
  • Loading branch information
elohanlon committed Jan 9, 2025
1 parent 4152948 commit 8ae5504
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions config/initializers/triclops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ def validate_triclops_config!
validate_triclops_config!

# If temp_directory is not set, default to ruby temp dir
TRICLOPS[:tmp_directory] = Dir.tmpdir if TRICLOPS[:tmp_directory].nil?

TRICLOPS[:tmp_directory] = File.join(Dir.tmpdir, Rails.application.class.module_parent_name.downcase) if TRICLOPS[:tmp_directory].blank?
# Make temp_directory if it does not already exist
FileUtils.mkdir_p(TRICLOPS[:tmp_directory])

# Set the TMPDIR ENV variable so that Vips (via Imogen) writes temp files here.
# If vips_tmp_directory is not set, default to ruby temp dir
TRICLOPS[:vips_tmp_directory] = File.join(Dir.tmpdir, Rails.application.class.module_parent_name.downcase) if TRICLOPS[:vips_tmp_directory].blank?
# Make vips_tmp_directory if it does not already exist
FileUtils.mkdir_p(TRICLOPS[:vips_tmp_directory])
# Set the TMPDIR ENV variable so that Vips (via Imogen) writes temp files to the vips_tmp_directory.
# This defaults to the OS temp directory if not otherwise set, which can be a
# problem if we're on a host that has limited local disk space.
ENV['TMPDIR'] = TRICLOPS[:tmp_directory]
Expand Down
2 changes: 2 additions & 0 deletions config/templates/triclops.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ development:
retry_delay: 1
retry_count: 11
tmp_directory: <%= Rails.root.join('tmp', 'triclops_development_tmp') %>
vips_tmp_directory: <%= Rails.root.join('tmp', 'triclops_development_tmp') %>

test:
run_queued_jobs_inline: true
Expand All @@ -25,3 +26,4 @@ test:
retry_delay: 1
retry_count: 11
tmp_directory: <%= Rails.root.join('tmp', 'triclops_test_tmp') %>
vips_tmp_directory: <%= Rails.root.join('tmp', 'triclops_test_tmp') %>

0 comments on commit 8ae5504

Please sign in to comment.