forked from mvemjsun/mock_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ru
More file actions
32 lines (27 loc) · 1.02 KB
/
config.ru
File metadata and controls
32 lines (27 loc) · 1.02 KB
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
#\ -p 9293 --host 0.0.0.0
require 'sinatra/base'
require 'active_record'
require 'sqlite3'
require 'tilt/haml'
require 'uri'
require 'HTTParty'
require 'logger'
Logger.class_eval { alias :write :'<<' }
$logger = ::Logger.new(::File.new("logs/app.log","a+"))
ENV['TEST_ENV']='production'
ENV['DEFAULT_CONTENT_TYPE'] = 'application/json;charset=UTF-8'
# Once the delimiter is set then it can only be changed if all mock db mock_data_response_headers are updated to use the new header
ENV['HEADER_DELIMITER'] = ":==:"
ENV['REPLACE'] = "1"
ENV['MAX_UPLOAD_SIZE'] = '500000'
# Integer setting the latency of responses, Global setting
ENV['LATENCY'] = '0'
ActiveRecord::Base.logger = Logger.new('logs/app.log')
ActiveRecord::Base.logger.level = Logger::DEBUG
db = YAML.load_file(File.expand_path('./config/database.yml'))['development']
ActiveRecord::Base.establish_connection db
Dir.glob('./{helpers,controllers,models}/*.rb').each do |file|
require file
end
map('/') { run ApplicationController}
map('/mock') { run MockServerController}