Multi-line config variables in Heroku

前端 未结 6 1072
别那么骄傲
别那么骄傲 2020-12-08 00:29

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

6条回答
  •  一向
    一向 (楼主)
    2020-12-08 00:43

    My answer comes a bit late but I had the same issue recently with multi-line env. variables on Heroku. My solution was to use strict_encode64:

    encoded_secret = Base64.strict_encode64("my_multi_line_secret")
    

    add the key:

    $ heroku config:set SECRET_KEY='the encoded_secret string here'
    

    In the code, you then decode it using Base64.strict_decode64(ENV['SECRET_KEY'])

提交回复
热议问题