aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/engine.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2017-12-01 11:07:30 -0500
committerGitHub <noreply@github.com>2017-12-01 11:07:30 -0500
commitb852ef2660dac36e348865b455fab7fbcc0d2a7f (patch)
tree5619b01097c922e4175055f6ebeaa8c7447257da /activestorage/lib/active_storage/engine.rb
parent32516e8862946da963e4ba9256553156ca321596 (diff)
downloadrails-b852ef2660dac36e348865b455fab7fbcc0d2a7f.tar.gz
rails-b852ef2660dac36e348865b455fab7fbcc0d2a7f.tar.bz2
rails-b852ef2660dac36e348865b455fab7fbcc0d2a7f.zip
Make ASt previewer/analyzer binary paths configurable
Diffstat (limited to 'activestorage/lib/active_storage/engine.rb')
-rw-r--r--activestorage/lib/active_storage/engine.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb
index 6cf6635c4f..b870e6d4d6 100644
--- a/activestorage/lib/active_storage/engine.rb
+++ b/activestorage/lib/active_storage/engine.rb
@@ -15,7 +15,8 @@ module ActiveStorage
config.active_storage = ActiveSupport::OrderedOptions.new
config.active_storage.previewers = [ ActiveStorage::Previewer::PDFPreviewer, ActiveStorage::Previewer::VideoPreviewer ]
- config.active_storage.analyzers = [ ActiveStorage::Analyzer::ImageAnalyzer, ActiveStorage::Analyzer::VideoAnalyzer ]
+ config.active_storage.analyzers = [ ActiveStorage::Analyzer::ImageAnalyzer, ActiveStorage::Analyzer::VideoAnalyzer ]
+ config.active_storage.paths = ActiveSupport::OrderedOptions.new
config.eager_load_namespaces << ActiveStorage
@@ -68,5 +69,21 @@ module ActiveStorage
end
end
end
+
+ initializer "active_storage.paths" do
+ config.after_initialize do |app|
+ if ffprobe_path = app.config.active_storage.paths.ffprobe
+ ActiveStorage::Analyzer::VideoAnalyzer.ffprobe_path = ffprobe_path
+ end
+
+ if ffmpeg_path = app.config.active_storage.paths.ffmpeg
+ ActiveStorage::Previewer::VideoPreviewer.ffmpeg_path = ffmpeg_path
+ end
+
+ if mutool_path = app.config.active_storage.paths.mutool
+ ActiveStorage::Previewer::PDFPreviewer.mutool_path = mutool_path
+ end
+ end
+ end
end
end