How to pass array environment variables to heroku using figaro gem

1.8k Views Asked by At

My application.yml file is as follows:

KEYS: ["xxxxxx", "yyyyyy", "zzzzzz"]

When I run 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?

1

There are 1 best solutions below

0
Michał Młoźniak On

Heroku only allows plain strings as environmental variables. 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(",")