生产环境变量 [英] Environment variables on production

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

问题描述

我正在亚马逊上部署我的Rails应用程序,我面临环境变量的问题。



我在开发和测试中使用了dotenv gem它在尝试访问我的环境变量时工作正常,但在生产中似乎不起作用。我看到,dotenv宝石并不意味着在生产中工作。我必须设置几乎20个不同的环境变量,包括API密钥等,我正在使用橡胶/ capistrano进行部署。



我如何以干净的方式使其工作?

解决方案

您可以使用

I’m currently deploying my Rails application on Amazon and I’m facing a problem with environment variables.

I'm using the dotenv gem on development and testing and it works just fine while trying to access my environment variables, but in production it does not seem to work. I read that the dotenv gem isn't meant to work on production. I have to set almost 20 different environment variables including API keys, etc., I'm deploying with rubber/capistrano.

How can I get this working in a clean way?

解决方案

You could use the figaro gem. I am using this and it works fine in production.

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

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