Sha256: bdf1eb2b89e31160480a68421134c8042e182f1a1815b6b11f63aececda1b778

Contents?: true

Size: 696 Bytes

Versions: 4

Compression:

Stored size: 696 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
    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

4 entries across 4 versions & 1 rubygems

Version Path
gaptool-server-0.4.12 lib/app.rb
gaptool-server-0.4.11 lib/app.rb
gaptool-server-0.4.10 lib/app.rb
gaptool-server-0.4.9 lib/app.rb