]> git.openstreetmap.org Git - rails.git/commitdiff
Provide a helpful warning if there's an application.yml file detected
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 13 Mar 2019 17:20:08 +0000 (18:20 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 13 Mar 2019 17:20:08 +0000 (18:20 +0100)
config/application.rb

index 2a0547a728f717e325012be7e87b64d69f88e7cf..d521b4a9cc9764fe909c003a558e8356f772d5fc 100644 (file)
@@ -1,5 +1,18 @@
 require_relative "boot"
 
 require_relative "boot"
 
+# Guard against deployments with old-style application.yml configurations
+# Otherwise, admins might not be aware that they are now silently ignored
+# and major problems could occur
+# rubocop:disable Rails/Output, Rails/Exit
+if File.exist?(File.expand_path("application.yml", __dir__))
+  puts "The config/application.yml file is no longer supported"
+  puts "Default settings are now found in config/settings.yml and you can override these in config/settings.local.yml"
+  puts "To prevent unexpected behaviour, please copy any custom settings to config/settings.local.yml"
+  puts " and then remove your config/application.yml file."
+  exit!
+end
+# rubocop:enable Rails/Output, Rails/Exit
+
 # Set the STATUS constant from the environment, if it matches a recognized value
 ALLOWED_STATUS = [
   :online,            # online and operating normally
 # Set the STATUS constant from the environment, if it matches a recognized value
 ALLOWED_STATUS = [
   :online,            # online and operating normally