Skip to content

Commit

Permalink
Blacklight.connection_config shouldn't depend on blacklight.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Oct 3, 2022
1 parent a1863fb commit 7a50130
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/blacklight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ def self.default_configuration
end

def self.connection_config
Blacklight::RuntimeRegistry.connection_config ||= begin
raise "The #{::Rails.env} environment settings were not found in the blacklight.yml config" unless blacklight_yml[::Rails.env]

blacklight_yml[::Rails.env].symbolize_keys
end
Blacklight::RuntimeRegistry.connection_config ||= blacklight_yml[::Rails.env]&.symbolize_keys if blacklight_yml?
end

def self.connection_config=(value)
Expand All @@ -84,7 +80,7 @@ def self.blacklight_yml
require 'yaml'

return @blacklight_yml if @blacklight_yml
unless File.exist?(blacklight_config_file)
unless blacklight_yml?
raise "You are missing a configuration file: #{blacklight_config_file}. Have you run \"rails generate blacklight:install\"?"
end

Expand All @@ -111,6 +107,10 @@ def self.blacklight_yml
@blacklight_yml
end

def self.blacklight_yml?
File.exist?(blacklight_config_file)
end

def self.logger
@logger ||= (::Rails.logger if defined? Rails && Rails.respond_to?(:logger))
end
Expand Down

0 comments on commit 7a50130

Please sign in to comment.