多行配置变量在Heroku [英] Multi-line config variables in Heroku
问题描述
我有一个Rails应用程序加载一些RSA证书,然后与Paypal进行交易。在我的开发机器上,这些证书是从文件系统中的文件读取的,但是因为Heroku(我用于delpoyment)是很大程度上只读,我不能上传这些文件,所以我猜我必须请从配置变量中读取证书(请参阅 Heroku Config Vars )。
I've have a Rails app that loads a number of RSA certificates before a transaction is made with Paypal. On my development machine, these certificates are read from files in the file system but because Heroku (which I'm using for delpoyment) is largely read-only, I can't upload these files so I'm guessing I'll have to read the certificates from config variables (see Heroku Config Vars).
因为证书由多行数据组成,我不知道如何将它们设置为变量,即使这是可能的。有人知道我该如何做到这一点,或者能够建议一种替代方法吗?
Because the certificates consist of multiple lines of data, I'm not sure how to set them as variables or even if this is possible. Does anyone know how I could do this or be able to suggest an alternative approach?
非常感谢,
Eddie
Many thanks, Eddie
推荐答案
我发现一个简单的添加多行配置的方法是双引号,然后从我的本地环境中回显它们
I found that a easy way to add multi-line configs is to double quote them and then echo them from my local environment
heroku config:add EC2_PRIVATE_KEY="$EC2_PRIVATE_KEY"
这篇关于多行配置变量在Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!