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 a677cba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions config/initializers/triclops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ 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] = Dir.tmpdir 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.
# 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]
# If vips_tmp_directory is not set, default to ruby temp dir
TRICLOPS['vips_tmp_directory'] = Dir.tmpdir if TRICLOPS['vips_tmp_directory'].blank?
# Make vips_tmp_directory if it does not already exist
FileUtils.mkdir_p(TRICLOPS['vips_tmp_directory'])
end

Rails.application.config.active_job.queue_adapter = :inline if TRICLOPS['run_queued_jobs_inline']
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 a677cba

Please sign in to comment.