from requests.packages import urllib3 from mgrctl.settings.environment import env from mgrctl.settings.platform import ( PLATFORM_TYPE, PLATFORM_VERIFY_SSL, PLATFORM_VERIFY_SSL_WARNING, PLATFORM_DUMMY, PLATFORM_DUMMY_API_URL, PLATFORM_DUMMY_EMAIL, PLATFORM_DUMMY_PASSWORD, PLATFORM_DUMMY_TOKEN, ) # Name of nginx container: API_INPUT_HOSTNAME = 'input' if PLATFORM_TYPE == 'vm' else 'dci_input_1' # Port that nginx container is listening: API_INPUT_PORT = '1500' # Internal API url: API_URL = f'http://{API_INPUT_HOSTNAME}:{API_INPUT_PORT}' # Headers for internal auth: API_HEADERS = {"Internal-Auth": "on", "Accept": "application/json"} # Alias for import: API_VERIFY_SSL = PLATFORM_VERIFY_SSL # API 3004 Unavailable error handler: API_COUNT_TRY_CONNECTIONS = env.int('API_COUNT_TRY_CONNECTIONS', 3) # Suppress warning from urllib3: if not PLATFORM_VERIFY_SSL_WARNING: # ! This is not recommended, # ! the user will not see a message about an untrusted SSL connection urllib3.disable_warnings( category=urllib3.exceptions.InsecureRequestWarning ) # Development mode: if PLATFORM_DUMMY: API_URL = PLATFORM_DUMMY_API_URL API_HEADERS = {'x-xsrf-token': PLATFORM_DUMMY_TOKEN} API_EMAIL = PLATFORM_DUMMY_EMAIL API_PASSWORD = PLATFORM_DUMMY_PASSWORD