Sha256: cfff4b206ba903f1c57b4f93bb204bece34d6852c1891c6846933c47c97ef043

Contents?: true

Size: 711 Bytes

Versions: 14

Compression:

Stored size: 711 Bytes

Contents

# encoding: utf-8
require 'sinatra'
require 'json'
require 'yaml'
require 'erb'
require 'aws-sdk'
require 'openssl'
require 'net/ssh'
require 'peach'

class GaptoolServer < Sinatra::Application
  disable :sessions
  enable  :dump_errors

  error do
    {:result => 'error', :message => env['sinatra.error']}.to_json
  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

14 entries across 14 versions & 1 rubygems

Version Path
gaptool-server-0.5.13 lib/app.rb
gaptool-server-0.5.12 lib/app.rb
gaptool-server-0.5.11 lib/app.rb
gaptool-server-0.5.10 lib/app.rb
gaptool-server-0.5.8 lib/app.rb
gaptool-server-0.5.7 lib/app.rb
gaptool-server-0.5.6 lib/app.rb
gaptool-server-0.5.5 lib/app.rb
gaptool-server-0.5.4 lib/app.rb
gaptool-server-0.5.3 lib/app.rb
gaptool-server-0.5.2 lib/app.rb
gaptool-server-0.5.1 lib/app.rb
gaptool-server-0.5.0 lib/app.rb
gaptool-server-0.4.14 lib/app.rb