class ApplicationController < ActionController::Base
  before_action :set_globals

  rescue_from CanCan::AccessDenied do |_exception|
    redirect_to root_path, alert: "You are not authorized to access this page."
  end

  def set_globals
    redis = Redis.new
    @gpu_active = redis.get("instance_state") == "running"
  rescue StandardError
    @gpu_active = false
  end
end
