Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make OKAPI_URL optional (e.g. when we're using the KafkaFolioReader) #1031

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/folio_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class FolioClient

attr_reader :base_url

def initialize(url: ENV.fetch('OKAPI_URL'), username: ENV.fetch('OKAPI_USER', nil), password: ENV.fetch('OKAPI_PASSWORD', nil), tenant: 'sul')
def initialize(url: ENV.fetch('OKAPI_URL', ''), username: ENV.fetch('OKAPI_USER', nil), password: ENV.fetch('OKAPI_PASSWORD', nil), tenant: 'sul')
uri = URI.parse(url)

@base_url = url
Expand Down
2 changes: 1 addition & 1 deletion lib/traject/config/folio_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
require './lib/traject/readers/folio_json_reader'
else
provide 'reader_class_name', 'Traject::FolioReader'
provide 'folio.client', FolioClient.new(url: self['okapi.url'] || ENV.fetch('OKAPI_URL', nil))
provide 'folio.client', FolioClient.new(url: self['okapi.url'] || ENV.fetch('OKAPI_URL', ''))
end

provide 'skip_empty_item_display', -1
Expand Down
2 changes: 1 addition & 1 deletion lib/traject/readers/kafka_folio_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Traject::KafkaFolioReader

def initialize(_input_stream, settings)
@settings = Traject::Indexer::Settings.new settings
@client = settings['folio.client'] || FolioClient.new
@client = settings['folio.client']
end

def each
Expand Down