Sha256: a4669682fc11711f814d4994ef35e7d8c6810a7e79b4703760a8bc91937f4ebb
Contents?: true
Size: 930 Bytes
Versions: 6
Compression:
Stored size: 930 Bytes
Contents
# encoding: utf-8 require 'sinatra' require 'json' require 'yaml' require 'erb' require 'aws-sdk' require 'openssl' require 'net/ssh' require 'peach' require 'airbrake' class GaptoolServer < Sinatra::Application error do {:result => 'error', :message => env['sinatra.error']}.to_json end configure do unless ENV['GAPTOOL_AIRBRAKE_KEY'].nil? Airbrake.configure do |cfg| cfg.api_key = ENV['GAPTOOL_AIRBRAKE_KEY'] end use Airbrake::Sinatra end disable :sessions enable :dump_errors end before do if request.path_info != '/ping' error 401 unless $redis.hget('users', env['HTTP_X_GAPTOOL_USER']) == env['HTTP_X_GAPTOOL_KEY'] error 401 unless env['HTTP_X_GAPTOOL_USER'] && env['HTTP_X_GAPTOOL_KEY'] end end helpers do include Rack::Utils alias_method :h, :escape_html end end require_relative 'helpers/init' require_relative 'routes/init'
Version data entries
6 entries across 6 versions & 1 rubygems