forked from External/greenlight
GRN2-211: Added a maintenance mode (#675)
* Added a maintenance mode * Cleaned up dockerignore file * Added branding to maintenance page * Fixed branding
This commit is contained in:
committed by
Jesus Federico
parent
670efeae31
commit
8b2c472536
@ -26,10 +26,11 @@ class ApplicationController < ActionController::Base
|
||||
# Force SSL for loadbalancer configurations.
|
||||
before_action :redirect_to_https
|
||||
|
||||
before_action :set_user_domain
|
||||
before_action :maintenance_mode?
|
||||
before_action :migration_error?
|
||||
before_action :set_locale
|
||||
before_action :check_admin_password
|
||||
before_action :set_user_domain
|
||||
before_action :check_user_role
|
||||
|
||||
# Manually handle BigBlueButton errors
|
||||
@ -45,6 +46,17 @@ class ApplicationController < ActionController::Base
|
||||
render :migration_error unless ENV["DB_MIGRATE_FAILED"].blank?
|
||||
end
|
||||
|
||||
def maintenance_mode?
|
||||
if ENV["MAINTENANCE_MODE"].present?
|
||||
render "errors/greenlight_error", status: 503, formats: :html,
|
||||
locals: {
|
||||
status_code: 503,
|
||||
message: I18n.t("errors.maintenance.message"),
|
||||
help: I18n.t("errors.maintenance.help"),
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Sets the appropriate locale.
|
||||
def set_locale
|
||||
update_locale(current_user)
|
||||
@ -140,6 +152,9 @@ class ApplicationController < ActionController::Base
|
||||
begin
|
||||
retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
||||
rescue => e
|
||||
# Use the default site settings
|
||||
@user_domain = "greenlight"
|
||||
|
||||
if e.message.eql? "No user with that id exists"
|
||||
render "errors/greenlight_error", locals: { message: I18n.t("errors.not_found.user_not_found.message"),
|
||||
help: I18n.t("errors.not_found.user_not_found.help") }
|
||||
|
@ -17,6 +17,7 @@
|
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class ThemesController < ApplicationController
|
||||
skip_before_action :maintenance_mode?
|
||||
before_action :provider_settings
|
||||
|
||||
# GET /primary
|
||||
|
Reference in New Issue
Block a user