-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings.py
67 lines (46 loc) · 1.35 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""
Connection settings for AAD IMAP server.
This module should NOT be saved in the repo, because it contains
sensitive details that only apply to the AAD environment.
Read comments in `settings_example.py` for each variable.
"""
import logging
import os
import re
import yaml
from imap import EmailAccount
BASE_PATH = os.path.join(os.getcwd(), '..', 'data', 'pending')
BASE_PATH = os.path.normpath(BASE_PATH)
SAVE_FOLDER = BASE_PATH
SETTINGS_YAML_PATH = os.path.join(os.getcwd(), 'settings.yaml')
# Where the DIF XML files can be found.
EMAIL_SERVER = os.environ['EMAIL_SERVER']
# Base path of where the converted XML should go.
EMAIL_USERNAME = os.environ['EMAIL_USERNAME']
# Base path of where the XML conversion files can be found.
EMAIL_PASSWORD = os.environ['EMAIL_PASSWORD']
LOGGING_FORMAT = '''
- file: %(pathname)s
function: %(funcName)s
level: %(levelname)s
line: %(lineno)s
logger: %(name)s
message: |
%(message)s
time: %(asctime)s
'''.strip()
LOGGING_LEVEL = logging.DEBUG
#LOGGING_LEVEL = logging.INFO
LOGGING_KWARGS = dict(
filemode='w',
#filename='underway.log',
format=LOGGING_FORMAT,
level=logging.DEBUG
)
def get_all_checks():
file_types = None
with open(SETTINGS_YAML_PATH) as r:
file_types = yaml.load(r)
return file_types
def get_email_server():
return EmailAccount(EMAIL_SERVER, EMAIL_USERNAME, EMAIL_PASSWORD)