This repository has been archived by the owner on Jun 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.rb
65 lines (55 loc) · 1.52 KB
/
index.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$LOAD_PATH << "#{File.dirname(__FILE__)}/"
require 'rubygems'
require 'sinatra'
require 'json'
require 'redis'
require 'bigdecimal'
require 'builder'
require 'digest'
require 'base64'
require 'rack'
require 'rack/cors'
require 'rack/protection'
require 'aws-sdk'
ENV['RACK_ENV'] = 'development' unless ENV['RACK_ENV']
require 'clientside_aws/mock/core'
require 'clientside_aws/dynamodb'
require 'clientside_aws/sqs'
require 'clientside_aws/s3'
require 'clientside_aws/ec2'
require 'clientside_aws/ses'
require 'clientside_aws/elastic_transcoder'
require 'clientside_aws/sns'
require 'clientside_aws/kinesis'
require 'clientside_aws/firehose'
options = if defined?(Sinatra::Base.settings.clientside_aws_testing) && \
Sinatra::Base.settings.clientside_aws_testing
{ host: 'localhost', port: 6380, timeout: 10 }
elsif ENV.key?('REDIS_HOST') && ENV.key?('REDIS_PORT')
{ host: ENV['REDIS_HOST'],
port: ENV['REDIS_PORT'].to_i }
else
# Use localhost port 6379
{}
end
AWS_REDIS = Redis.new(options)
configure :development do
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: [:get, :post, :options, :put]
end
end
set :protection, except: [:http_origin]
end
DYNAMODB_PREFIX = 'DynamoDBv20110924'.freeze
S3_CONFIG = {
region: 'us-mockregion-1',
access_key_id: '...',
secret_access_key: '...',
force_path_style: true,
endpoint: 'http://localstack:4572'
}.freeze
get '/' do
'hello'
end