single_ursim_control/single_ursim_control/config.py

18 lines
821 B
Python

import sys
import os
# Config is loaded statically at import time
class Config:
RUN_ID = os.environ.get("RUN_ID", "")
SYNC_DELAY = float(os.environ.get("SYNC_DELAY", 1.0))
REDIS_URL = os.environ["REDIS_URL"]
SYNC_TIMEOUT = os.environ.get("SYNC_TIMEOUT", None) # Wait infinity by default
ROBOT_ADDRESS = os.environ.get("ROBOT_ADDRESS")
PROGRAM_URL = os.environ["PROGRAM_URL"]
DRY_RUN = ('--dry-run' in sys.argv) or bool(os.environ.get("DRY_RUN", "").upper() in ['YES', 'TRUE', '1'])
DEBUG = ('--debug' in sys.argv) or bool(os.environ.get("DEBUG", "").upper() in ['YES', 'TRUE', '1'])
HTTP_ENABLE = ('--no-http' not in sys.argv) and \
bool(os.environ.get("HTTP_ENABLE", "").upper() not in ['NO', 'FALSE', '0'])
HTTP_PORT = int(os.environ.get("HTTP_PORT", 8080))