diff --git a/umich_catalog_indexing/lib/services.rb b/umich_catalog_indexing/lib/services.rb index dbfd4668..67f6d0bf 100644 --- a/umich_catalog_indexing/lib/services.rb +++ b/umich_catalog_indexing/lib/services.rb @@ -8,3 +8,4 @@ require_relative "services/logger" require_relative "services/dbs" require_relative "services/solr" +require_relative "services/sftp" diff --git a/umich_catalog_indexing/lib/services/sftp.rb b/umich_catalog_indexing/lib/services/sftp.rb new file mode 100644 index 00000000..023b545e --- /dev/null +++ b/umich_catalog_indexing/lib/services/sftp.rb @@ -0,0 +1,10 @@ +require "sftp" +S.register(:sftp_user) { ENV.fetch("ALMA_FILES_USER", "alma") } +S.register(:sftp_host) { ENV.fetch("ALMA_FILES_HOST", "sftp") } +S.register(:ssh_key_path) { ENV.fetch("SSH_KEY_PATH", "/etc/secret-volume/id_rsa") } + +SFTP.configure do |config| + config.user = S.sftp_user + config.host = S.sftp_host + config.key_path = S.ssh_key_path +end diff --git a/umich_catalog_indexing/lib/sidekiq_jobs.rb b/umich_catalog_indexing/lib/sidekiq_jobs.rb index 5c28d18f..15a5bbc6 100644 --- a/umich_catalog_indexing/lib/sidekiq_jobs.rb +++ b/umich_catalog_indexing/lib/sidekiq_jobs.rb @@ -1,6 +1,7 @@ $:.unshift File.dirname(__FILE__).to_s require "sidekiq" require "jobs" +require "services" class JobQueued def call(worker, job, queue, redis_pool) @@ -42,12 +43,6 @@ def call(worker, job, queue) end end -SFTP.configure do |config| - config.user = ENV.fetch("ALMA_FILES_USER") - config.host = ENV.fetch("ALMA_FILES_HOST") - config.key_path = ENV.fetch("SSH_KEY_PATH") -end - class IndexIt include Sidekiq::Worker def perform(file, solr_url)