-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py
43 lines (37 loc) · 1.22 KB
/
settings.py
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
import tornado.options
import logging
tornado.options.define("environment", default="dev", help="environment")
options = {
'dev' : {
'logging_level' : logging.DEBUG,
'certfile' : 'apns_development.pem',
'apns_host' : ( 'gateway.sandbox.push.apple.com', 2195 ),
'feedback_host' : ( 'feedback.sandbox.push.apple.com', 2196 ),
'memcached' : ['127.0.0.1:11211'],
'apns_reconnect_lag' : 5,
'feedback_enabled' : True,
'feedback_reconnect_lag' : 60
},
'prod' : {
'logging_level' : logging.DEBUG,
'certfile' : 'apns_production.pem',
'apns_host' : ( 'gateway.push.apple.com', 2195 ),
'feedback_host' : ( 'feedback.push.apple.com', 2196 ),
'memcached' : ['127.0.0.1:11211'],
'apns_reconnect_lag' : 1,
'feedback_enabled' : True,
'feedback_reconnect_lag' : 60
}
}
default_options = {
}
def env():
return tornado.options.options.environment
def get(key):
env = tornado.options.options.environment
if env not in options:
raise Exception("Invalid Environment (%s)" % env)
v = options.get(env).get(key) or default_options.get(key)
if callable(v):
return v()
return v