Sha256: aadf7b58a94514ae56b863be51161637873f96689975526f2268032e8820f7b8

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

module MiddlewareHealthcheck
  class Configuration
    DEFAULT_HEALTHCHECK_PATH = '/healthcheck'.freeze
    DEFAULT_FULL_CHECK_PARAM_NAME = 'full'.freeze
    DEFAULT_SELECTED_CHECK_PARAM_NAME = 'checks'.freeze
    DEFAULT_ERROR_RESPONSE_STATUS = 422
    DEFAULT_SUCCESS_RESPONSE_STATUS = 200
    DEFAULT_SUCCESS_RESPONSE_BODY = "It's alive!".freeze
    DEFAULT_ERRORS_DELIMITER = '; '.freeze
    DEFAULT_SELECTED_CHECK_PARAM_SPLIT_DELIMITER = ','.freeze

    attr_accessor :healthcheck_path, :full_check_param_name, :selected_check_param_name,
      :error_response_status, :success_response_status, :success_response_body,
      :errors_delimiter, :selected_check_param_split_delimiter, :checkers

    def initialize
      self.healthcheck_path = DEFAULT_HEALTHCHECK_PATH
      self.full_check_param_name = DEFAULT_FULL_CHECK_PARAM_NAME
      self.selected_check_param_name = DEFAULT_SELECTED_CHECK_PARAM_NAME
      self.error_response_status = DEFAULT_ERROR_RESPONSE_STATUS
      self.success_response_status = DEFAULT_SUCCESS_RESPONSE_STATUS
      self.success_response_body = DEFAULT_SUCCESS_RESPONSE_BODY
      self.errors_delimiter = DEFAULT_ERRORS_DELIMITER
      self.selected_check_param_split_delimiter = DEFAULT_SELECTED_CHECK_PARAM_SPLIT_DELIMITER
      self.checkers = MiddlewareHealthcheck::DefaultCheckers.constants.map do |const|
        klass = MiddlewareHealthcheck::DefaultCheckers.const_get(const)
        klass if klass.is_a? Class
      end.compact
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleware_healthcheck-0.2.2 lib/middleware_healthcheck/configuration.rb
middleware_healthcheck-0.2.1 lib/middleware_healthcheck/configuration.rb