diff --git a/compose.yml b/compose.yml index c07ed1c..e8766a8 100644 --- a/compose.yml +++ b/compose.yml @@ -14,6 +14,12 @@ services: env_file: - .env - env.development + networks: + - mynetwork volumes: gem_cache: + +networks: + mynetwork: + external: true diff --git a/env.example b/env.example index 260c22e..9f2fe44 100644 --- a/env.example +++ b/env.example @@ -1,9 +1,9 @@ BIBLIO_SOLR='http://biblio-server/solr' -AUTHOR_SOLR='http://catalog-solr-server/solr' +SOLRCLOUD_URL='http://solr-cloud-server/solr' BROWSE_SOLR='http://catalog-solr-server/solr' CALLNUMBER_CORE='callnumbers' AUTHORITY_CORE='authority_core' -AUTHOR_COLLECTION='author_collection' +AUTHORITY_COLLECTION='authority_collection' SOLR_USER='solr' SOLR_PASSWORD='SolrRocks' -SOLR_CLOUD_ON='false' +SOLRCLOUD_ON='false' diff --git a/lib/models/author_list.rb b/lib/models/author_list.rb index 07a640a..c9ade37 100644 --- a/lib/models/author_list.rb +++ b/lib/models/author_list.rb @@ -6,7 +6,7 @@ def self.for(direction:, reference_id:, num_rows_to_display:, original_reference num_rows_to_display: num_rows_to_display, original_reference: original_reference, banner_reference: banner_reference, - browse_solr_client: BrowseSolrClient.new(solr_url: S.author_solr, core: S.author_collection, match_field: "term", q: "browse_field:name", solr_cloud_on: S.solr_cloud_on?) + browse_solr_client: BrowseSolrClient.new(solr_url: S.solrcloud_url, core: S.authority_collection, match_field: "term", q: "browse_field:name", solrcloud_on: S.solrcloud_on?) ) new(browse_list: browse_list) diff --git a/lib/models/subject_list.rb b/lib/models/subject_list.rb index bbd21a5..1c92ba9 100644 --- a/lib/models/subject_list.rb +++ b/lib/models/subject_list.rb @@ -6,7 +6,7 @@ def self.for(direction:, reference_id:, num_rows_to_display:, original_reference num_rows_to_display: num_rows_to_display, original_reference: original_reference, banner_reference: banner_reference, - browse_solr_client: BrowseSolrClient.new(core: ENV.fetch("AUTHORITY_CORE"), match_field: "term", q: "browse_field:subject") + browse_solr_client: BrowseSolrClient.new(solr_url: S.solrcloud_url, core: S.authority_collection, match_field: "term", q: "browse_field:subject", solrcloud_on: S.solrcloud_on?) ) new(browse_list: browse_list) diff --git a/lib/services.rb b/lib/services.rb index f899c1b..50d3494 100644 --- a/lib/services.rb +++ b/lib/services.rb @@ -3,16 +3,16 @@ Services = Canister.new S = Services -S.register(:solr_cloud_on?) do - ENV["SOLR_CLOUD_ON"] == "true" +S.register(:solrcloud_on?) do + ENV["SOLRCLOUD_ON"] == "true" end -S.register(:author_solr) do - ENV["AUTHOR_SOLR"] || ENV["BROWSE_SOLR"] +S.register(:authority_collection) do + S.solrcloud_on? ? ENV["AUTHORITY_COLLECTION"] : ENV["AUTHORITY_CORE"] end -S.register(:author_collection) do - ENV["AUTHOR_COLLECTION"] || ENV["AUTHORITY_CORE"] +S.register(:solrcloud_url) do + S.solrcloud_on? ? ENV["SOLRCLOUD_URL"] : ENV["BROWSE_SOLR"] end [ diff --git a/lib/utilities/browse_solr_client.rb b/lib/utilities/browse_solr_client.rb index 9f9ae0a..3399f02 100644 --- a/lib/utilities/browse_solr_client.rb +++ b/lib/utilities/browse_solr_client.rb @@ -1,12 +1,12 @@ require "faraday" class BrowseSolrClient - def initialize(solr_url: ENV.fetch("BROWSE_SOLR"), core: ENV.fetch("CALLNUMBER_CORE"), match_field: "callnumber", q: "*:*", solr_cloud_on: false) + def initialize(solr_url: ENV.fetch("BROWSE_SOLR"), core: ENV.fetch("CALLNUMBER_CORE"), match_field: "callnumber", q: "*:*", solrcloud_on: false) @conn = Faraday.new( url: solr_url ) do |f| f.request :json - f.request :authorization, :basic, ENV["SOLR_USER"], ENV["SOLR_PASSWORD"] if solr_cloud_on + f.request :authorization, :basic, ENV["SOLR_USER"], ENV["SOLR_PASSWORD"] if solrcloud_on # f.request :retry, {max: 1, retry_statuses: [500]} f.response :json end