Adds additional validation to 'env_vars_from_file'.

The 'env_file' directive and feature precludes the use of the name
'.env' in the path shared with 'docker-config.yml', regardless of
whether or not it is enabled.

This change adds an additional validation to allow the use of this
path provided it is not a file.

Signed-off-by: Thom Linton <thom.linton@gmail.com>
This commit is contained in:
Thom Linton 2016-04-29 16:31:19 -07:00
parent 8cc7d68a00
commit 28fb91b344
1 changed files with 2 additions and 0 deletions

View File

@ -28,6 +28,8 @@ def env_vars_from_file(filename):
""" """
if not os.path.exists(filename): if not os.path.exists(filename):
raise ConfigurationError("Couldn't find env file: %s" % filename) raise ConfigurationError("Couldn't find env file: %s" % filename)
elif not os.path.isfile(filename):
raise ConfigurationError("%s is not a file." % (filename))
env = {} env = {}
for line in codecs.open(filename, 'r', 'utf-8'): for line in codecs.open(filename, 'r', 'utf-8'):
line = line.strip() line = line.strip()