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

问题描述

我从 heroku 知道可以通过在本地运行 heroku config:add MY_ENV_VAR=123 来添加环境变量.我怎样才能用 engineyard 达到同样的效果?

I know from heroku that it’s possible to add environment variables by running heroku config:add MY_ENV_VAR=123 locally. How can I achieve the same thing with engineyard?

推荐答案

我们遇到了同样的问题,向 EngineYard 寻求帮助.来自安永的 Jim Neath 回复如下:

We ran into the same issue and asked EngineYard for some assistance. Jim Neath from EY came back with the following response:

不幸的是,乘客没有获得传递的环境变量从系统.您需要做的是创建一个 ruby​​ 包装器使用它定义您的环境变量并启动乘客,如此处描述:

http://blog.phusion.nl/2008/12/16/passing-environment-variables-to-ruby-from-phusion-passenger/

我为您创建了一个基本的自定义厨师食谱,可以做到这一点:

I have created you a basic custom chef recipe that will do just this:

https://github.com/jimneath/ey-cloud-recipes/tree/master/cookbooks/passenger_env_vars

您需要使用您的环境更新以下文件变量:

You will need to update the following file with your environment variables:

/ey-cloud-recipes/blob/master/cookbooks/passenger_env_vars/templates/default/env.custom.erb

/ey-cloud-recipes/blob/master/cookbooks/passenger_env_vars/templates/default/env.custom.erb

这篇关于在engineyard中设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 17:15