Skip to content

Commit

Permalink
moves sftp env vars and config to services
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Mar 20, 2024
1 parent 8d56112 commit b667828
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions umich_catalog_indexing/lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
require_relative "services/logger"
require_relative "services/dbs"
require_relative "services/solr"
require_relative "services/sftp"
10 changes: 10 additions & 0 deletions umich_catalog_indexing/lib/services/sftp.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions umich_catalog_indexing/lib/sidekiq_jobs.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b667828

Please sign in to comment.