Merge pull request #954 from okriuchykhin/ok_SCI_1970

Add health check endpoint to API controller [SCI-1970]
This commit is contained in:
okriuchykhin 2018-01-25 14:33:37 +01:00 committed by GitHub
commit 0b1f43c1c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -4,9 +4,9 @@ module Api
attr_reader :token
attr_reader :current_user
before_action :load_token, except: %i(authenticate status)
before_action :load_iss, except: %i(authenticate status)
before_action :authenticate_request!, except: %i(authenticate status)
before_action :load_token, except: %i(authenticate status health)
before_action :load_iss, except: %i(authenticate status health)
before_action :authenticate_request!, except: %i(authenticate status health)
rescue_from StandardError do |e|
logger.error e.message
@ -24,6 +24,10 @@ module Api
@iss = nil
end
def health
render plain: 'RUNNING'
end
def status
response = {}
response[:message] = I18n.t('api.core.status_ok')

View file

@ -501,6 +501,7 @@ Rails.application.routes.draw do
end
namespace :api, defaults: { format: 'json' } do
get 'health', to: 'api#health'
get 'status', to: 'api#status'
post 'auth/token', to: 'api#authenticate'
scope '20170715', module: 'v20170715' do