forked from kencochrane/pypi-mirrors
-
Notifications
You must be signed in to change notification settings - Fork 9
/
config.py
53 lines (48 loc) · 1.86 KB
/
config.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
53
import os
import sys
import json
PY2 = sys.version_info < (3, 0)
# mirrors listed here
MIRRORS = [
('https', 'pypi.shuosc.org'),
('http', 'mirrors.163.com/pypi'),
('https', 'mirror-ord.pypi.io'),
('https', 'pypi.doubanio.com'),
('https', 'pypi.fcio.net'),
('https', 'pypi.tuna.tsinghua.edu.cn'),
('http', 'mirror.picosecond.org/pypi'),
('http', 'mirrors.aliyun.com/pypi'),
('https', 'pypi.pubyun.com'),
('http', 'mirrors-uk.go-parts.com/python'),
('http', 'mirrors-ru.go-parts.com/python'),
('http', 'mirrors-au.go-parts.com/python'),
('https', 'pypi.mirrors.ustc.edu.cn'),
]
EMAIL_OVERRIDE = None # None or "[email protected]"
def load_config():
envvars = '/etc/pypi-mirrors-environment.json'
if os.path.exists(envvars):
env = json.load(open(envvars))
env.update(os.environ)
else:
env = os.environ
return {
'host': env.get('CACHE_REDIS_HOST', 'localhost'),
'port': env.get('CACHE_REDIS_PORT', 6379),
'password': env.get('CACHE_REDIS_PASSWORD'),
'db': 1,
'ip_api_key': env.get('IPLOC_API_KEY', None),
'twitter_consumer_key': env.get('TWITTER_CONSUMER_KEY', None),
'twitter_consumer_secret': env.get('TWITTER_CONSUMER_SECRET', None),
'twitter_access_key': env.get('TWITTER_ACCESS_KEY', None),
'twitter_access_secret': env.get('TWITTER_ACCESS_SECRET', None),
'email_host': env.get('EMAIL_HOST', None),
'email_port': env.get('EMAIL_PORT', None),
'email_user': env.get('EMAIL_USER', None),
'email_password': env.get('EMAIL_PASSWORD', None),
'email_from': env.get('EMAIL_FROM', None),
'email_to': env.get('EMAIL_TO', None),
'email_bcc': env.get('EMAIL_BCC', None),
'email_to_admin': env.get('EMAIL_TO_ADMIN', None),
'sentry_dsn': env.get('SENTRY_DSN', None),
}