summaryrefslogtreecommitdiff
path: root/app/controllers/static_config_controller.rb
blob: 46e7cd2ebafd99e5b344cebe47035fd8fcda2408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# This controller is responsible for returning some static config files, such as /provider.json
#
class StaticConfigController < ActionController::Base
  include ControllerExtension::JsonFile

  before_filter :set_minimum_client_version

  def provider
    send_file provider_json
  end

  protected

  # ensure that the header X-Minimum-Client-Version is sent
  # regardless if a 200 or 304 (not modified) or 404 response is sent.
  def set_minimum_client_version
    response.headers["X-Minimum-Client-Version"] =
      APP_CONFIG[:minimum_client_version].to_s
  end

  def provider_json
    Rails.root.join APP_CONFIG[:config_file_paths]['provider']
  end

end