class ActiveFedora::FileConfigurator
def get_config_path(config_type)
-
(String)-
Parameters:
-
config_type(String) -- Either ‘fedora’ or ‘solr’
def get_config_path(config_type) config_type = config_type.to_s if (config_path = config_options.fetch("#{config_type}_config_path".to_sym,nil) ) raise ConfigurationError, "file does not exist #{config_path}" unless ::File.file? config_path return ::File.expand_path(config_path) end # if solr, attempt to use path where fedora.yml is first if config_type == "solr" && (config_path = check_fedora_path_for_solr) return config_path end if defined?(Rails.root) config_path = "#{Rails.root}/config/#{config_type}.yml" return config_path if ::File.file? config_path end if ::File.file? "#{Dir.getwd}/config/#{config_type}.yml" return "#{Dir.getwd}/config/#{config_type}.yml" end # Last choice, check for the default config file config_path = ::File.join(ActiveFedora.root, "config", "#{config_type}.yml") if ::File.file? config_path ActiveFedora::Base.logger.warn "Using the default #{config_type}.yml that comes with active-fedora. If you want to override this, pass the path to #{config_type}.yml to ActiveFedora - ie. ActiveFedora.init(:#{config_type}_config_path => '/path/to/#{config_type}.yml') - or set Rails.root and put #{config_type}.yml into \#{Rails.root}/config." if ActiveFedora::Base.logger return config_path else raise ConfigurationError, "Couldn't load #{config_type} config file!" end end