Interpolate environment variables

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-07-24 15:58:18 +01:00
commit 8b5bd945d0
9 changed files with 235 additions and 35 deletions

View file

@ -8,6 +8,7 @@ import six
from compose.cli.utils import find_candidates_in_parent_dirs
from .interpolation import interpolate_environment_variables
from .errors import (
ConfigurationError,
CircularReference,
@ -132,11 +133,11 @@ def get_config_path(base_dir):
def load(config_details):
dictionary, working_dir, filename = config_details
dictionary = interpolate_environment_variables(dictionary)
service_dicts = []
for service_name, service_dict in list(dictionary.items()):
if not isinstance(service_dict, dict):
raise ConfigurationError('Service "%s" doesn\'t have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.' % service_name)
loader = ServiceLoader(working_dir=working_dir, filename=filename)
service_dict = loader.make_service_dict(service_name, service_dict)
validate_paths(service_dict)
@ -429,9 +430,9 @@ def resolve_volume_paths(volumes, working_dir=None):
def resolve_volume_path(volume, working_dir):
container_path, host_path = split_path_mapping(volume)
container_path = os.path.expanduser(os.path.expandvars(container_path))
container_path = os.path.expanduser(container_path)
if host_path is not None:
host_path = os.path.expanduser(os.path.expandvars(host_path))
host_path = os.path.expanduser(host_path)
return "%s:%s" % (expand_path(working_dir, host_path), container_path)
else:
return container_path