mirror of https://github.com/docker/compose.git
Less verbose environment invocation
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
dcdcf4869b
commit
0ff53d9668
|
@ -9,6 +9,7 @@ import six
|
||||||
|
|
||||||
from . import verbose_proxy
|
from . import verbose_proxy
|
||||||
from .. import config
|
from .. import config
|
||||||
|
from ..config.environment import Environment
|
||||||
from ..const import API_VERSIONS
|
from ..const import API_VERSIONS
|
||||||
from ..project import Project
|
from ..project import Project
|
||||||
from .docker_client import docker_client
|
from .docker_client import docker_client
|
||||||
|
@ -34,7 +35,7 @@ def get_config_path_from_options(base_dir, options):
|
||||||
if file_option:
|
if file_option:
|
||||||
return file_option
|
return file_option
|
||||||
|
|
||||||
environment = config.environment.Environment.from_env_file(base_dir)
|
environment = Environment.from_env_file(base_dir)
|
||||||
config_files = environment.get('COMPOSE_FILE')
|
config_files = environment.get('COMPOSE_FILE')
|
||||||
if config_files:
|
if config_files:
|
||||||
return config_files.split(os.pathsep)
|
return config_files.split(os.pathsep)
|
||||||
|
@ -58,7 +59,7 @@ def get_project(project_dir, config_path=None, project_name=None, verbose=False,
|
||||||
config_details = config.find(project_dir, config_path)
|
config_details = config.find(project_dir, config_path)
|
||||||
project_name = get_project_name(config_details.working_dir, project_name)
|
project_name = get_project_name(config_details.working_dir, project_name)
|
||||||
config_data = config.load(config_details)
|
config_data = config.load(config_details)
|
||||||
environment = config.environment.Environment.from_env_file(project_dir)
|
environment = Environment.from_env_file(project_dir)
|
||||||
|
|
||||||
api_version = environment.get(
|
api_version = environment.get(
|
||||||
'COMPOSE_API_VERSION',
|
'COMPOSE_API_VERSION',
|
||||||
|
@ -75,7 +76,7 @@ def get_project_name(working_dir, project_name=None):
|
||||||
def normalize_name(name):
|
def normalize_name(name):
|
||||||
return re.sub(r'[^a-z0-9]', '', name.lower())
|
return re.sub(r'[^a-z0-9]', '', name.lower())
|
||||||
|
|
||||||
environment = config.environment.Environment.from_env_file(working_dir)
|
environment = Environment.from_env_file(working_dir)
|
||||||
project_name = project_name or environment.get('COMPOSE_PROJECT_NAME')
|
project_name = project_name or environment.get('COMPOSE_PROJECT_NAME')
|
||||||
if project_name:
|
if project_name:
|
||||||
return normalize_name(project_name)
|
return normalize_name(project_name)
|
||||||
|
|
|
@ -20,7 +20,8 @@ Compose expects each line in an env file to be in `VAR=VAL` format. Lines
|
||||||
beginning with `#` (i.e. comments) are ignored, as are blank lines.
|
beginning with `#` (i.e. comments) are ignored, as are blank lines.
|
||||||
|
|
||||||
> Note: Values present in the environment at runtime will always override
|
> Note: Values present in the environment at runtime will always override
|
||||||
> those defined inside the `.env` file.
|
> those defined inside the `.env` file. Similarly, values passed via
|
||||||
|
> command-line arguments take precedence as well.
|
||||||
|
|
||||||
Those environment variables will be used for
|
Those environment variables will be used for
|
||||||
[variable substitution](compose-file.md#variable-substitution) in your Compose
|
[variable substitution](compose-file.md#variable-substitution) in your Compose
|
||||||
|
|
Loading…
Reference in New Issue