Sha256: d9134ef506dff47bf18af8f554ac9948343bad34a84189afd1953064ccd7bb22

Contents?: true

Size: 607 Bytes

Versions: 14

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

module Waylon
  module Services
    # A Ping Service for monitoring
    class Ping < Sinatra::Base
      configure do
        set :protection, except: :http_origin
        set :logging, ::Waylon::Logger
      end

      before do
        content_type "application/json"
        halt 403 unless request.get? || request.options?
      end

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

      get "/" do
        { status: :ok }.to_json
      end

      options "/" do
        halt 200
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
waylon-core-0.3.0 lib/waylon/services/ping.rb
waylon-core-0.2.6 lib/waylon/services/ping.rb
waylon-core-0.2.5 lib/waylon/services/ping.rb
waylon-core-0.2.4 lib/waylon/services/ping.rb
waylon-core-0.2.3 lib/waylon/services/ping.rb
waylon-core-0.2.2 lib/waylon/services/ping.rb
waylon-core-0.2.1 lib/waylon/services/ping.rb
waylon-core-0.2.0 lib/waylon/services/ping.rb
waylon-core-0.1.9 lib/waylon/services/ping.rb
waylon-core-0.1.8 lib/waylon/services/ping.rb
waylon-core-0.1.6 lib/waylon/services/ping.rb
waylon-core-0.1.5 lib/waylon/services/ping.rb
waylon-core-0.1.4 lib/waylon/services/ping.rb
waylon-core-0.1.3 lib/waylon/services/ping.rb