Skip to content

Commit 5042704

Browse files
committed
Set the TEMPDIR ENV variable in the Triclops initializer (for Vips tempdir)
1 parent b453873 commit 5042704

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

config/initializers/triclops.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,21 @@ def validate_triclops_config!
3333
raise "Missing required config TRICLOPS[:config][:#{required_key}]"
3434
end
3535
end
36-
37-
# If temp_directory is not set, default to ruby temp dir
38-
TRICLOPS[:tmp_directory] = Dir.tmpdir if TRICLOPS[:tmp_directory].nil?
3936
end
4037

4138
# Raster cache config validation
4239
Rails.application.config.after_initialize do
4340
# We need to run this after_initialize because at least one of our validations depends on
4441
# a constant from an auto-loaded file, and modules are only auto-loaded after initialization.
4542
validate_triclops_config!
43+
44+
# If temp_directory is not set, default to ruby temp dir
45+
TRICLOPS[:tmp_directory] = Dir.tmpdir if TRICLOPS[:tmp_directory].nil?
46+
47+
# Set the TMPDIR ENV variable so that Vips (via Imogen) writes temp files here.
48+
# This defaults to the OS temp directory if not otherwise set, which can be a
49+
# problem if we're on a host that has limited local disk space.
50+
ENV['TMPDIR'] = TRICLOPS[:tmp_directory]
4651
end
4752

4853
Rails.application.config.active_job.queue_adapter = :inline if TRICLOPS['run_queued_jobs_inline']

0 commit comments

Comments
 (0)