supervisord environment variables setting up application

泄露秘密 提交于 2019-12-05 05:32:20

The relevant documentation section explains that you need to list the variables as comma-separated key/value pairs:

environment

A list of key/value pairs in the form KEY=val,KEY2=val2 that will be placed in the supervisord process’ environment (and as a result in all of its child process’ environments). This option can include the value %(here)s, which expands to the directory in which the supervisord configuration file was found. Note that subprocesses will inherit the environment variables of the shell used to start supervisord except for the ones overridden here and within the program’s environment configuration stanza.

The example for this section also uses commas:

environment = KEY1=value1,KEY2=value2

Internally this is parsed into a dict using the python shlex lexer, so it'll deal with quoting properly. It'll also strip whitespace, so to make things more readable, you could divide things over multiple lines:

environment =
    KEY1="Some longer value containing whitespace",
    KEY2=value2-on-a-new-line,

Note that a trailing comma is optional; it won't make a difference in the output.

Missing a comma after KEY1 however could lead to weird values (the above example, minus the comma after whitespace" would give you {'KEY1': 'Some longer value containing whitespace', '=': ','} as the environment dict) as the equals sign requirement isn't rigorously checked. I've submitted a pull request to remedy that.

As it turns out, the trailing comma is an issue. I quoted all the env strings and removed the trailing comma. All works now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!