maestrano/mno-enterprise

View on GitHub
api/app/controllers/mno_enterprise/status_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
# Health Check endpoint
module MnoEnterprise
  class StatusController < ApplicationController
    # Skip filters than rely on MnoHub (RemoteAuthenticatable)
    skip_before_filter :handle_password_change
    skip_before_filter :perform_return_to

    # Simple check to see that the app is up
    # Returns:
    #   {status: 'Ok'}
    def ping
      render json: {status: 'Ok'}
    end

    # Version check
    # Returns:
    #   {
    #     'app-version': '9061048-6811c4a',
    #     'mno-enterprise-version': '0.0.1',
    #     'env': 'test',
    #     'mno-api-host': 'https://uat.maestrano.io'
    #   }
    def version
      data = {
          'app-version' => MnoEnterprise::APP_VERSION,
          'mno-enteprise-version' => MnoEnterprise::VERSION,
          'env' => Rails.env,
          'mno-api-host' => MnoEnterprise.mno_api_host
      }
      render json: data
    end
  end
end