如何为多个进程重用主管进程的环境定义
我定义了多个主管程序,并且它们都定义了相同的环境变量,现在我需要添加一个新的,并且必须将其添加到每个程序部分。有没有办法定义一个对整个主管配置文件有效并且我可以重用的环境变量?例如 /etc/supervisor/conf.d/foo.conf
下的文件:
my_env=foo=2,bar="hi",zee="ok"
[program:foo]
environment=my_env
[program:bar]
environment=my_env
I have multiple supervisor programs defined and they all have the same environment variables defined, now I needed to add a new one and I had to add it to each program section. Is there a way to define a environment variable which is valid for the whole supervisor config file and which I could reuse? E.g file under /etc/supervisor/conf.d/foo.conf
:
my_env=foo=2,bar="hi",zee="ok"
[program:foo]
environment=my_env
[program:bar]
environment=my_env
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的。您可以将自定义环境键值添加到 Supervisord 部分,位于
环境
键。环境
由于您有多个正在运行的管理程序,我相信您需要在每个 .conf 文件的 [supervisord] 部分中指定此环境键值对。
编辑:为了澄清OP在评论中的混乱,[supervisord]部分与[program]部分不同。
Yes, that's possible. You may add your custom environment key-values into the Supervisord section, below the
environment
key.environment
Since you have multiple supervisor programs running, I believe you will need to specify this environment key-value pairs in the [supervisord] section of each .conf file.
Edit: To clarify OP's confusion in comments, [supervisord] section is different from a [program] section.