-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
34 lines (25 loc) · 779 Bytes
/
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
"""
Config File
"""
import yaml
from defs import PROJECT_PATH
# Read config.yaml
_config_dict: dict
with open(file=PROJECT_PATH.joinpath('config.yaml'),
mode='r',
encoding='utf-8') as config:
_config_dict = yaml.safe_load(config)
# Parse Deployment
DEPLOYMENT: str | None
if 'deployment' in _config_dict and _config_dict['deployment'][0] == 'D':
DEPLOYMENT = 'D'
# Default to Production if not Development or invalid input
else:
DEPLOYMENT = 'P'
# Parse user data
NAME: str | None = _config_dict['name'] if 'name' in _config_dict else None
EMAIL: str | None = _config_dict['email'] if 'email' in _config_dict else None
if __name__ == '__main__':
print('Deployment: ', DEPLOYMENT)
print('Name: ', NAME)
print('Email: ', EMAIL)