base_controller.rb 562 B

12345678910111213141516171819202122
  1. module Blazer
  2. class BaseController < ApplicationController
  3. # skip all filters
  4. skip_filter *_process_action_callbacks.map(&:filter)
  5. protect_from_forgery with: :exception
  6. if ENV["BLAZER_PASSWORD"]
  7. http_basic_authenticate_with name: ENV["BLAZER_USERNAME"], password: ENV["BLAZER_PASSWORD"]
  8. end
  9. layout "blazer/application"
  10. before_action :ensure_database_url
  11. private
  12. def ensure_database_url
  13. render text: "BLAZER_DATABASE_URL required" if !ENV["BLAZER_DATABASE_URL"] && !Rails.env.development?
  14. end
  15. end
  16. end