lib/cas/config.rb in cas-cms-0.1.3 vs lib/cas/config.rb in cas-cms-1.0.0.alpha1

- old
+ new

@@ -8,25 +8,30 @@ end def uploads uploads = config["uploads"] || {} + # TODO - clarify what this is and how to configure { cache_directory_prefix: uploads["cache_directory_prefix"] || "cache", store_directory_prefix: uploads["store_directory_prefix"] || "store" } end private def read_file - @file ||= YAML.load_file(filename) + begin + @file ||= YAML.safe_load_file(filename, aliases: true) + rescue NoMethodError, ArgumentError + @file ||= YAML.load_file(filename) + end end def filename @filename ||= begin - if File.exists?("cas.yml") - "cas.yml" + if File.exists?(Cas::CONFIG_PATH) + Cas::CONFIG_PATH elsif ENV['RAILS_ENV'] == 'test' "spec/fixtures/cas.yml" else raise "cas.yml file is not defined." end