19 lines
609 B
Python
19 lines
609 B
Python
from utils.libs.decouple import config, UndefinedValueError
|
|
from utils.utils import str_to_bool
|
|
from utils.logger import logger
|
|
|
|
def set_conf_value(key):
|
|
try:
|
|
value = config(key)
|
|
if value == '':
|
|
logger.warn(f'WARNING: The variable {key} is an empty string.')
|
|
return value
|
|
except (UndefinedValueError):
|
|
logger.warn(f'WARNING: Please set the variable {key} in the .env file based on .env.example.')
|
|
return None
|
|
|
|
class App:
|
|
DownloaderLink=set_conf_value('DOWNLOADER_LINK')
|
|
ParserEndpointList=set_conf_value('PARSER_ENDPOINT_LIST')
|
|
ScheduleTime=set_conf_value('SCHEDULE_TIME')
|