Sha256: 876c346b9499b0f4597c7210f2e85d6931f21a58189f0128087018121d407533

Contents?: true

Size: 489 Bytes

Versions: 3

Compression:

Stored size: 489 Bytes

Contents

require "sinatra"

class Octogate::Server < Sinatra::Base
  configure :production, :development do
    enable :logging
  end

  post '/:token' do
    unless Octogate.config.token == params[:token]
      status 403
      body "Access forbidden"
      return
    end

    event_name = request.env["HTTP_X_GITHUB_EVENT"]
    event_klass = Octogate::Event.get(event_name)
    event = event_klass.parse(params[:payload])
    Octogate::Client.new(event).request_to_targets

    return
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
octogate-0.2.2 lib/octogate/server.rb
octogate-0.2.1 lib/octogate/server.rb
octogate-0.2.0 lib/octogate/server.rb