]> source.dussan.org Git - redmine.git/commitdiff
Psych 4: aliases in database.yml cause Psych::BadAlias exception (#35435).
authorGo MAEDA <maeda@farend.jp>
Sat, 3 Jul 2021 23:13:32 +0000 (23:13 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 3 Jul 2021 23:13:32 +0000 (23:13 +0000)
Patch by Pavel Rosický.

git-svn-id: http://svn.redmine.org/redmine/trunk@21059 e93f8b46-1217-0410-a6f0-8f06a7374b81

Gemfile

diff --git a/Gemfile b/Gemfile
index 7093980b8b79ebdf7a9c20ec4afeb1a6df62acea..984cc078a2d1e9a289bb4878fe1bf162a29d1efe 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -52,7 +52,8 @@ require 'erb'
 require 'yaml'
 database_file = File.join(File.dirname(__FILE__), "config/database.yml")
 if File.exist?(database_file)
-  database_config = YAML::load(ERB.new(IO.read(database_file)).result)
+  yaml_config = ERB.new(IO.read(database_file)).result
+  database_config = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(yaml_config) : YAML.load(yaml_config)
   adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
   if adapters.any?
     adapters.each do |adapter|