Sha256: 5b98429f1bc5c4959ed5947fec4fa2ec6b8ef688a4579d0422fc24837dd399f5

Contents?: true

Size: 789 Bytes

Versions: 10

Compression:

Stored size: 789 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 :show_exceptions
  enable :raise_errors
  enable :dump_errors

  error do
    content_type :json
    status 500

    {:result => 'error', :message => env['sinatra.error'].message}.to_json
  end

  before do
    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

  helpers do
    include Rack::Utils
    alias_method :h, :escape_html
  end
end

require_relative 'helpers/init'
require_relative 'models/init'
require_relative 'routes/init'

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gaptool-server-0.4.7 lib/app.rb
gaptool-server-0.4.6 lib/app.rb
gaptool-server-0.4.5 lib/app.rb
gaptool-server-0.4.4 lib/app.rb
gaptool-server-0.4.3 lib/app.rb
gaptool-server-0.4.2 lib/app.rb
gaptool-server-0.4.1 lib/app.rb
gaptool-server-0.4.0 lib/app.rb
gaptool-server-0.3.8 lib/app.rb
gaptool-server-0.3.7 lib/app.rb