X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/97d5d1d3850e63fadd9664b9982428f058625c5b..bb43a46babaf2f2853cf33567380b085c02aea9e:/app/controllers/application.rb?ds=sidebyside diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 792792f83..085a3fa9f 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -34,10 +34,19 @@ class ApplicationController < ActionController::Base # no auth, the user does not exist or the password was wrong response.headers["Status"] = "Unauthorized" response.headers["WWW-Authenticate"] = "Basic realm=\"#{realm}\"" - render_text(errormessage, 401) # :unauthorized + render :text => errormessage, :status => :unauthorized + return false end end + def check_availability + if API_READONLY + response.headers['Error'] = "Database offline for maintenance" + render :nothing => true, :status => :service_unavailable + return false + end + end + # Report and error to the user # (If anyone ever fixes Rails so it can set a http status "reason phrase", # rather than only a status code and having the web engine make up a