This repository was archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathconfig.ru
More file actions
52 lines (40 loc) · 1.45 KB
/
config.ru
File metadata and controls
52 lines (40 loc) · 1.45 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'bundler/setup'
require 'rack/contrib'
require 'rack-cache'
require 'dalli'
require 'memcachier'
require './api/lib/rack/static_cache'
require './api/app'
require './api/app_embedded'
# Gzip responses
use Rack::Deflater
if ENV['RACK_ENV'] == 'production'
# Set Cache-Control and ETag headers
use Rack::StaticCache, urls: ['/js', '/img', '/css', '/fonts', '/favicon.ico'], root: 'public', duration: 90
if memcachier_servers = ENV['MEMCACHIER_SERVERS']
cache = Dalli::Client.new memcachier_servers.split(','), {
username: ENV['MEMCACHIER_USERNAME'],
password: ENV['MEMCACHIER_PASSWORD']
}
use Rack::Cache, verbose: true, metastore: cache, entitystore: cache
elsif memcached_server = ENV['MEMCACHED_URL']
cache = Dalli::Client.new memcached_server
use Rack::Cache, verbose: true, metastore: cache, entitystore: cache
end
run Rack::URLMap.new({
'http://embed.sassmeister.com/' => SassMeisterEmbeddedApp,
'https://embed.sassmeister.com/' => SassMeisterEmbeddedApp,
'/' => SassMeisterApp
})
else
use Rack::Static, urls: ['/js', '/img', '/css', '/fonts', '/favicon.ico'], root: 'public'
use Rack::Cache,
verbose: true,
metastore: 'memcached://localhost:11211',
entitystore: 'memcached://localhost:11211'
run Rack::URLMap.new({
'http://embed.sassmeister.dev/' => SassMeisterEmbeddedApp,
'http://embed-local.sassmeister.com/' => SassMeisterEmbeddedApp,
'/' => SassMeisterApp
})
end