设置应用程序的 supervisord 环境变量 [英] supervisord environment variables setting up application

查看:146
本文介绍了设置应用程序的 supervisord 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 supervisord 运行一个应用程序,我必须为它设置一个环境.大约有 30 个环境变量需要设置.我试过把所有的都放在一个大的

I'm running an application from supervisord and I have to set up an environment for it. There are about 30 environment variables that need to be set. I've tried putting all on one big

环境=

行,这似乎不起作用.我也尝试了多个 environment= 行,但这似乎也不起作用.我也试过在 env 值周围有和没有 ' .

line and that doesn't seem to work. I've also tried multiple enviroment= lines, and that doesn't seem to work either. I've also tried both with and without ' around the env value.

设置我的环境以使其在监督控制下保持完整的最佳方法是什么?我应该从 shell 脚本调用我的实际程序(tornado,fwiw),并在那里预加载环境?理想情况下,我想将所有环境变量放入一个包含文件中并使用主管加载它们,但我愿意以另一种方式来做.

What's the best way to set up my environment such that it remains intact under supervisord control? Should I be calling my actual program (tornado, fwiw) from a shell script with the environment preloaded there? Ideally, I'd like to put all of the enviroment variables into an include file and load them with supervisor, but I'm open to doing it another way.

更新:

这是我在 conf 文件中使用的内容:

Here is what I'm using in the conf file:

environment=
    PYTHONPATH=/srv/obsf/current/:$PYTHONPATH,
    PYTHON_EGG_CACHE=/srv/obfs/current/.python-eggs,
    OBFS_API_ENVIRONMENT_STAGE=test,

这持续了大约 30 行,有很多环境变量.当我执行程序时,它立即崩溃并抱怨未设置环境变量 OBFS_API_ENVRIONMENT_STAGE.

This goes on for about 30 lines, with a lot of environment variables. When I execute the program, it crashes immediately complaining that the environment variable OBFS_API_ENVRIONMENT_STAGE is not set.

推荐答案

事实证明,尾随逗号是一个问题.我引用了所有 env 字符串并删除了尾随逗号.现在一切正常.

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

这篇关于设置应用程序的 supervisord 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆