]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application.rb
Allow the API to be taken offline completely as well as being put into
[rails.git] / app / controllers / application.rb
index d22ed5c9f5d17154815873d93c238def19e6fbd5..acb2f916291ab02aced0486022b4688c2b109677 100644 (file)
@@ -39,8 +39,16 @@ class ApplicationController < ActionController::Base
     end 
   end 
 
-  def check_availability
-    if API_READONLY
+  def check_read_availability
+    if API_STATUS == :offline
+      response.headers['Error'] = "Database offline for maintenance"
+      render :nothing => true, :status => :service_unavailable
+      return false
+    end
+  end
+
+  def check_write_availability
+    if API_STATUS == :offline or API_STATUS == :readonly
       response.headers['Error'] = "Database offline for maintenance"
       render :nothing => true, :status => :service_unavailable
       return false