The relevant documentation section http://supervisord.org/configuration.html#supervisord-section-values解释说您需要将变量列出为逗号分隔的键/值对:
环境
格式为 KEY=val,KEY2=val2 的键/值对列表,将放置在主管进程的环境中(并因此放置在其所有子进程的环境中)。此选项可以包含值 %(here)s,该值扩展为在其中找到supervisord 配置文件的目录。请注意,子进程将继承用于启动 Supervisord 的 shell 的环境变量,但此处和程序的环境配置节中覆盖的变量除外。
The example for this section http://supervisord.org/configuration.html#supervisord-section-example也使用逗号:
environment = KEY1=value1,KEY2=value2
在内部这是parsed into a dict https://github.com/Supervisor/supervisor/blob/0b05ee3db077bf9e8e2fbe64d283ae91fb72a864/supervisor/datatypes.py#L69使用Pythonshlex lexer http://docs.python.org/library/shlex.html,因此它将正确处理引用。它还会去除空格,因此为了使内容更具可读性,您可以将内容分成多行:
environment =
KEY1="Some longer value containing whitespace",
KEY2=value2-on-a-new-line,
请注意,尾随逗号是可选的;它不会对输出产生影响。
然而,在 KEY1 之后缺少逗号可能会导致奇怪的值(上面的示例,减去后面的逗号)whitespace"
会给你{'KEY1': 'Some longer value containing whitespace', '=': ','}
作为环境字典),因为等号要求没有经过严格检查。我有提交了拉取请求 https://github.com/Supervisor/supervisor/pull/125来弥补这一点。