Heroku error when adding an Environment Variable that is a Comma Separated Value with Spaces
<p>Here is a variable that is defined in my local .env file in my app. I created it to be a comma separated value, like so:</p>

<pre><code> STATE_KEYWORDS=georgia,new york,new jersey,maine,vermont,florida 
</code></pre>

<p>In my seed.rb file, I call on that STATE_KEYWORDS variable by using the "fetch" and "split" methods to turn it into an array, because I need that attribute ("keywords") to be an array:  </p>

<pre><code> Category.create(name: "U.S. States", keywords: ENV.fetch("STATES_KEYWORDS").split(","))
</code></pre>

<p>This works fine when I run my app remotely, but when I push to Heroku, it seems as if Heroku is not recognizing/picking up the .env file. So I tried to add the  variable like this: </p>

<p>heroku config:add STATE_KEYWORDS=georgia,new york,new jersey,maine,vermont,florida</p>

<p>But then I get this error: </p>

<pre><code> new york,new jersey,maine,vermont,florida
 is invalid. Must be in the format FOO=bar.
</code></pre>

<p>I don't think it likes the space between "new" and "york". Or "new" and "jersey"...etc. It wants it to be one fluid value. </p>

<p>But I need the "keywords" array to equal the below, with some elements in that array being 2 or 3-worded strings:</p>

<pre><code> keywords: ["georgia", "new york", "new jersey", "maine", "vermont", "florida"]
</code></pre>

<p>How can I do this? How can I add this .env variable to Heroku (i'm not married to leaving them in an .env file, I just can't have them pushed up to my Github/Heroku in plain view, for everyone to see. Those keywords have to be hidden...which is why locally I had them in a .env file. </p>

<p>Also, I have ".env" in my.gitignore file, which is why I successfully pushed to Github without that file appearing there. </p>