2024-06-04 23:38:17 +08:00
|
|
|
from requests.packages import urllib3
|
2024-06-05 23:08:10 +08:00
|
|
|
|
2024-06-04 23:38:17 +08:00
|
|
|
from mgrctl.settings.platform import (
|
|
|
|
PLATFORM_TYPE,
|
2024-06-05 23:08:10 +08:00
|
|
|
PLATFORM_VERIFY_SSL,
|
|
|
|
PLATFORM_VERIFY_SSL_WARNING,
|
|
|
|
PLATFORM_DUMMY,
|
|
|
|
PLATFORM_DUMMY_API_URL,
|
|
|
|
PLATFORM_DUMMY_EMAIL,
|
|
|
|
PLATFORM_DUMMY_PASSWORD,
|
|
|
|
PLATFORM_DUMMY_TOKEN,
|
2024-06-04 23:38:17 +08:00
|
|
|
)
|
2024-05-26 22:06:58 +08:00
|
|
|
|
|
|
|
# Name of nginx container:
|
2024-06-05 23:08:10 +08:00
|
|
|
API_INPUT_HOSTNAME = 'input' if PLATFORM_TYPE == 'vm' else 'dci_input_1'
|
2024-05-26 22:06:58 +08:00
|
|
|
|
|
|
|
# Port that nginx container is listening:
|
2024-06-05 23:08:10 +08:00
|
|
|
API_INPUT_PORT = '1500'
|
2024-05-26 22:06:58 +08:00
|
|
|
|
2024-06-04 23:38:17 +08:00
|
|
|
# Internal API url:
|
2024-06-05 23:08:10 +08:00
|
|
|
API_URL = f'http://{API_INPUT_HOSTNAME}:{API_INPUT_PORT}'
|
2024-06-04 23:38:17 +08:00
|
|
|
|
2024-05-26 22:06:58 +08:00
|
|
|
# Headers for internal auth:
|
2024-06-05 23:08:10 +08:00
|
|
|
API_HEADERS = {"Internal-Auth": "on", "Accept": "application/json"}
|
|
|
|
|
|
|
|
# Alias for import:
|
|
|
|
API_VERIFY_SSL = PLATFORM_VERIFY_SSL
|
2024-06-04 23:38:17 +08:00
|
|
|
|
|
|
|
# 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
|
|
|
|
)
|
2024-06-05 23:08:10 +08:00
|
|
|
|
|
|
|
# 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
|