-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
52 lines (41 loc) · 1.32 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
import os
def get_targets():
raw_text = os.getenv('SCRAPE_TARGETS', 'BTC,ETH,DOGE,SOL')
return raw_text.split(',')
def get_interval():
return float(os.getenv('SCRAPE_INTERVAL', 30))
def get_email_sender():
return os.getenv('EMAIL_SENDER')
def get_email_receiver():
return os.getenv('EMAIL_RECEIVER')
def get_email_password():
return os.getenv('EMAIL_PASSWORD')
def get_email_smtp_server():
return os.getenv('EMAIL_SMTP_SERVER')
def get_email_smtp_port():
return int(os.getenv('EMAIL_SMTP_PORT', 587))
def get_email_config():
return {
'sender': get_email_sender(),
'receiver': get_email_receiver(),
'password': get_email_password(),
'smtp_server': get_email_smtp_server(),
'smtp_port': get_email_smtp_port(),
}
def get_lsratio_threshold():
return float(os.getenv('LSRATIO_THRESHOLD', 20))
def sanitized(text: str):
if text is None:
return ''
return '*' * len(text)
def get_all_configs():
return [
('scrape_interval', get_interval()),
('scrape_targets', ','.join(get_targets())),
('email_sender', get_email_sender()),
('email_receiver', get_email_receiver()),
('email_password', sanitized(get_email_password())),
('email_smtp_server', get_email_smtp_server()),
('email_smtp_port', get_email_smtp_port()),
('lsratio_threshold', get_lsratio_threshold()),
]