1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class ManagementController < ApplicationController
8 skip_around_action :thread_clear
9 skip_around_action :set_thread_api_token
10 skip_around_action :require_thread_api_token
11 skip_before_action :ensure_arvados_api_exists
12 skip_before_action :accept_uuid_as_id_param
13 skip_before_action :check_user_agreements
14 skip_before_action :check_user_profile
15 skip_before_action :load_filters_and_paging_params
16 skip_before_action :find_object_by_uuid
18 before_action :check_auth_header
21 mgmt_token = Rails.configuration.ManagementToken
22 auth_header = request.headers['Authorization']
25 render :json => {:errors => "disabled"}, :status => 404
27 render :json => {:errors => "authorization required"}, :status => 401
28 elsif auth_header != 'Bearer '+mgmt_token
29 render :json => {:errors => "authorization error"}, :status => 403
34 render content_type: 'text/plain', plain: <<~EOF
35 # HELP arvados_config_load_timestamp_seconds Time when config file was loaded.
36 # TYPE arvados_config_load_timestamp_seconds gauge
37 arvados_config_load_timestamp_seconds{sha256="#{Rails.configuration.SourceSHA256}"} #{Rails.configuration.LoadTimestamp.to_f}
38 # HELP arvados_config_source_timestamp_seconds Timestamp of config file when it was loaded.
39 # TYPE arvados_config_source_timestamp_seconds gauge
40 arvados_config_source_timestamp_seconds{sha256="#{Rails.configuration.SourceSHA256}"} #{Rails.configuration.SourceTimestamp.to_f}
41 # HELP arvados_version_running Indicated version is running.
42 # TYPE arvados_version_running gauge
43 arvados_version_running{version="#{AppVersion.package_version}"} 1
48 resp = {"health" => "OK"}