mirror of
https://github.com/docker/compose.git
synced 2025-07-25 22:54:54 +02:00
HTTP_TIMEOUT as importable constant for consistency
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
b110bbe9e3
commit
f9c7346380
@ -5,6 +5,8 @@ import ssl
|
|||||||
from docker import Client
|
from docker import Client
|
||||||
from docker import tls
|
from docker import tls
|
||||||
|
|
||||||
|
from ..const import HTTP_TIMEOUT
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -39,6 +41,5 @@ def docker_client():
|
|||||||
|
|
||||||
if 'DOCKER_CLIENT_TIMEOUT' in os.environ:
|
if 'DOCKER_CLIENT_TIMEOUT' in os.environ:
|
||||||
log.warn('The DOCKER_CLIENT_TIMEOUT environment variable is deprecated. Please use COMPOSE_HTTP_TIMEOUT instead.')
|
log.warn('The DOCKER_CLIENT_TIMEOUT environment variable is deprecated. Please use COMPOSE_HTTP_TIMEOUT instead.')
|
||||||
timeout = int(os.environ.get('COMPOSE_HTTP_TIMEOUT', os.environ.get('DOCKER_CLIENT_TIMEOUT', 60)))
|
|
||||||
|
|
||||||
return Client(base_url=base_url, tls=tls_config, version=api_version, timeout=timeout)
|
return Client(base_url=base_url, tls=tls_config, version=api_version, timeout=HTTP_TIMEOUT)
|
||||||
|
@ -2,7 +2,6 @@ from __future__ import print_function
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
@ -17,6 +16,7 @@ from .. import __version__
|
|||||||
from .. import legacy
|
from .. import legacy
|
||||||
from ..config import parse_environment
|
from ..config import parse_environment
|
||||||
from ..const import DEFAULT_TIMEOUT
|
from ..const import DEFAULT_TIMEOUT
|
||||||
|
from ..const import HTTP_TIMEOUT
|
||||||
from ..progress_stream import StreamOutputError
|
from ..progress_stream import StreamOutputError
|
||||||
from ..project import ConfigurationError
|
from ..project import ConfigurationError
|
||||||
from ..project import NoSuchService
|
from ..project import NoSuchService
|
||||||
@ -71,7 +71,7 @@ def main():
|
|||||||
log.error(
|
log.error(
|
||||||
"An HTTP request took too long to complete. Retry with --verbose to obtain debug information.\n"
|
"An HTTP request took too long to complete. Retry with --verbose to obtain debug information.\n"
|
||||||
"If you encounter this issue regularly because of slow network conditions, consider setting "
|
"If you encounter this issue regularly because of slow network conditions, consider setting "
|
||||||
"COMPOSE_HTTP_TIMEOUT to a higher value (current value: %s)." % os.environ.get('COMPOSE_HTTP_TIMEOUT', 60)
|
"COMPOSE_HTTP_TIMEOUT to a higher value (current value: %s)." % HTTP_TIMEOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 10
|
DEFAULT_TIMEOUT = 10
|
||||||
LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-number'
|
LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-number'
|
||||||
@ -6,3 +7,4 @@ LABEL_PROJECT = 'com.docker.compose.project'
|
|||||||
LABEL_SERVICE = 'com.docker.compose.service'
|
LABEL_SERVICE = 'com.docker.compose.service'
|
||||||
LABEL_VERSION = 'com.docker.compose.version'
|
LABEL_VERSION = 'com.docker.compose.version'
|
||||||
LABEL_CONFIG_HASH = 'com.docker.compose.config-hash'
|
LABEL_CONFIG_HASH = 'com.docker.compose.config-hash'
|
||||||
|
HTTP_TIMEOUT = int(os.environ.get('COMPOSE_HTTP_TIMEOUT', os.environ.get('DOCKER_CLIENT_TIMEOUT', 60)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user