Sha256: 3af60eb3defd80cd3144059548c738bf959ff1c5389c1115acb689bb7e89b79c

Contents?: true

Size: 719 Bytes

Versions: 17

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

module Bullion
  module Services
    # Healthcheck service
    class Ping < Sinatra::Application
      configure do
        set :logging, true
        set :logger, Bullion::LOGGER
      end

      before do
        content_type "application/json"

        halt 403 unless request.get? || request.options?

        if request.get?
          headers "X-Frame-Options" => "SAMEORIGIN"
          headers "X-XSS-Protection" => "1; mode=block"
        end
      end

      after do
        headers "Access-Control-Allow-Methods" => %w[GET] if request.options?
      end

      get "/" do
        '{ "status": "up" }'
      end

      options "/" do
        halt 200
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bullion-0.7.3 lib/bullion/services/ping.rb
bullion-0.7.2 lib/bullion/services/ping.rb
bullion-0.7.1 lib/bullion/services/ping.rb
bullion-0.7.0 lib/bullion/services/ping.rb
bullion-0.6.2 lib/bullion/services/ping.rb
bullion-0.6.1 lib/bullion/services/ping.rb
bullion-0.6.0 lib/bullion/services/ping.rb
bullion-0.5.1 lib/bullion/services/ping.rb
bullion-0.5.0 lib/bullion/services/ping.rb
bullion-0.4.3 lib/bullion/services/ping.rb
bullion-0.4.2 lib/bullion/services/ping.rb
bullion-0.4.1 lib/bullion/services/ping.rb
bullion-0.4.0 lib/bullion/services/ping.rb
bullion-0.3.3 lib/bullion/services/ping.rb
bullion-0.3.2 lib/bullion/services/ping.rb
bullion-0.3.1 lib/bullion/services/ping.rb
bullion-0.3.0 lib/bullion/services/ping.rb