forked from jayridge/c2dmtornado
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py
53 lines (47 loc) · 1.43 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
43
44
45
46
47
48
49
50
51
52
import tornado.options
import logging
tornado.options.define("environment", default="dev", help="environment")
options = {
'dev' : {
'logging_level' : logging.DEBUG,
'max_concurrent' : 256,
'memcached' : ['127.0.0.1:11211'],
'collapse_key' : 'Path',
'c2dm_url' : 'https://android.apis.google.com/c2dm/send',
'login_url' : 'https://www.google.com/accounts/ClientLogin',
'login' : {
'Email' : '',
'Passwd' : '',
'source' : '',
'service' : 'ac2dm',
'accountType' : 'HOSTED_OR_GOOGLE',
}
},
'prod' : {
'logging_level' : logging.DEBUG,
'max_concurrent' : 256,
'memcached' : ['127.0.0.1:11211'],
'collapse_key' : 'Path',
'c2dm_url' : 'https://android.apis.google.com/c2dm/send',
'login_url' : 'https://www.google.com/accounts/ClientLogin',
'login' : {
'Email' : '',
'Passwd' : '',
'source' : '',
'service' : 'ac2dm',
'accountType' : 'HOSTED_OR_GOOGLE',
}
}
}
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