Teach dev instance setup script to handle new style configuration
authorTom Hughes <tom@compton.nu>
Fri, 17 May 2019 18:37:47 +0000 (19:37 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 17 May 2019 18:43:14 +0000 (19:43 +0100)
cookbooks/dev/templates/default/rails.setup.rb.erb

index 1539fb7e69172a4fe5e8d4690d2454a5121b037e..ad42b68f723ed186eed5de0a80a436020c8f8d04 100644 (file)
@@ -17,7 +17,11 @@ OpenStreetMap::Application.config.after_initialize do
       id.save!
     end
 
-    ID_KEY = id.key
+    if Kernel.const_defined?("Settings")
+      Settings.id_key = id.key
+    else
+      ID_KEY = id.key
+    end
 
     unless potlatch = webmaster.client_applications.find_by_name("Potlatch 2")
       potlatch = webmaster.client_applications.new
@@ -27,7 +31,11 @@ OpenStreetMap::Application.config.after_initialize do
       potlatch.save!
     end
 
-    POTLATCH2_KEY = potlatch.key
+    if Kernel.const_defined?("Settings")
+      Settings.potlatch2_key = potlatch.key
+    else
+      POTLATCH2_KEY = potlatch.key
+    end
 
     unless website = webmaster.client_applications.find_by_name("Web Site")
       website = webmaster.client_applications.new
@@ -37,6 +45,10 @@ OpenStreetMap::Application.config.after_initialize do
       website.save!
     end
 
-    OAUTH_KEY = website.key
+    if Kernel.const_defined?("Settings")
+      Settings.oauth_key = website.key
+    else
+      OAUTH_KEY = website.key
+    end
   end
 end