"""Application configuration.""" import logging import os from dotenv import load_dotenv # Load env file if it exists load_dotenv(verbose=True) # Logger Name LOGGER_NAME = os.environ.get('LOGGER_NAME', 'swf-workflow-monitor') LOGGER_LEVEL = logging.INFO LOGGER_DSN = os.environ.get('LOGGER_DSN') or None ENVIRONMENT = os.environ.get('Environment', 'dev') print('The environment is {}'.format(ENVIRONMENT)) if ENVIRONMENT not in ['dev', 'qa', 'prod']: raise Exception('The specified environment is not properly named.') AWS_DEFAULT_REGION = os.environ.get('AWS_DEFAULT_REGION', 'us-east-1') SENTRY_DSN = os.environ.get('SENTRY_DSN') or None SWF_MONITOR_DOMAIN = os.environ.get( 'SWF_MONITOR_DOMAIN', '{}_swf_feed_ingestion'.format(ENVIRONMENT)) """ SWF_MONITOR_GRACE_PERIOD_SECONDS: A grace period in seconds controlling how long to wait before killing task if no open workflow executions are found. This can guard against delays from the SWF API in registering or returning active executions. """ SWF_MONITOR_GRACE_PERIOD_SECONDS = int( os.environ.get('SWF_MONITOR_GRACE_PERIOD_SECONDS', 600)) """ SWF_MONITOR_MAX_RUNNING_DAYS: How many days back to search for active executions. Executions older than this number of days will be considered stalled or irrevocably hung, and the fargate task will be killed. This does not affect, update, or close the SWF execution itself. """ SWF_MONITOR_MAX_RUNNING_DAYS = int( os.environ.get('SWF_MONITOR_MAX_RUNNING_DAYS', 1)) """ SWF_MONITOR_TASK_RUNTIME_LIMIT_MINUTES: How long this monitor task can run before being killed on its own. This is to prevent tasks from running interminably for erroneous conditions. """ SWF_MONITOR_TASK_RUNTIME_LIMIT_MINUTES = int( os.environ.get('SWF_MONITOR_TASK_RUNTIME_LIMIT_MINUTES', 10080)) SWF_MONITOR_WORKFLOW_NAME = os.environ.get('SWF_MONITOR_WORKFLOW_NAME') # Service information SERVICE_NAME = os.environ.get( 'SERVICE_NAME', 'swf-workflow-monitor-{}'.format( SWF_MONITOR_WORKFLOW_NAME ) ) SERVICE_VERSION = '1.0.0'