[英]How to pass array environment variables to heroku using figaro gem
My application.yml
file is as follows: 我的
application.yml
文件如下:
KEYS: ["xxxxxx", "yyyyyy", "zzzzzz"]
When I run figaro heroku:set
当我运行
figaro heroku:set
I receive this error: 我收到此错误:
.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/figaro-1.1.1/lib/figaro/cli/heroku_set.rb:7:in `system': no implicit conversion of Integer into String (TypeError)
Anyone know how I should format arrays in application.yml
? 有谁知道我应该如何格式化
application.yml
数组?
Heroku only allows plain strings as environmental variables. Heroku仅允许将纯字符串作为环境变量。 If you still want to pass an array, you need to join it into string and then split in your code.
如果仍要传递数组,则需要将其连接为字符串,然后拆分为代码。
# application.yml
KEYS: "xxxxxx,yyyyyy,zzzzzz"
And then in your application code you can use it like 然后在您的应用程序代码中,您可以像
(ENV["KEYS"] || "").split(",")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.