通过.env文件docker传递多行string
关于.env
文件的Docker 文档缺乏细节。
在docker-compose.yml文件中我有:
LETSENCRYPT_HOST: | abc.domain.com, abe.domain.com, aba.domain.com
我想移动到.env
文件,这可能吗?
文档说
撰写期望env文件中的每一行都是VAR = VAL格式
它归结为config/environment.py#env_vars_from_file()
函数:
def env_vars_from_file(filename): """ Read in a line delimited file of environment variables. """ if not os.path.exists(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 = {} for line in codecs.open(filename, 'r', 'utf-8'): line = line.strip() if line and not line.startswith('#'): k, v = split_env(line) env[k] = v return env
提交PR要求以' \
'结尾的行被认为是多行应该很容易。
但现在情况并非如此。