How to send a multiline file to Heroku Config

On occasion, I’ll need to add sensitive configuration data to a Heroku application that happens to be multiline or contains non-alphanumeric characters. For example, uploading a public or private key file, where whitespace (including vertical whitespace) is significant. Another example that I ran into recently was uploading a JSON file for Google Auth configuration.

The solution is pretty straightforward:

$ heroku config:set FOO="$(< /my/file.json)"

That’s it. If you feel like it, you can confirm that the data is represented accurately by checking heroku config.

Perhaps this will help you if you’re in a similar situation. Cheers!

 
97
Kudos
 
97
Kudos

Now read this

Fixing Broken `gem install` from Xcode update

Quick tip: upgrading to Xcode 8.0 on a Mac with existing dev tools installed results in compilation failures due to the build tool license. You need to agree to the new license before proceeding, which requires running with admin... Continue →