class ActiveFedora::FileConfigurator
def load_fedora_config
def load_fedora_config return @fedora_config unless @fedora_config.empty? @fedora_config_path = config_path(:fedora) ActiveFedora::Base.logger.info("ActiveFedora: loading fedora config from #{::File.expand_path(@fedora_config_path)}") begin config_erb = ERB.new(IO.read(@fedora_config_path)).result(binding) rescue StandardError raise("fedora.yml was found, but could not be parsed with ERB. \n#{$ERROR_INFO.inspect}") end begin fedora_yml = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1') YAML.safe_load(config_erb, permitted_classes: [], permitted_symbols: [], aliases: true) else YAML.safe_load(config_erb, [], [], true) # allow YAML aliases end rescue Psych::SyntaxError => e raise "fedora.yml was found, but could not be parsed. " \ "Error #{e.message}" end config = fedora_yml.symbolize_keys cfg = config[ActiveFedora.environment.to_sym] || {} @fedora_config = cfg.is_a?(Array) ? cfg.map(&:symbolize_keys) : cfg.symbolize_keys end