Rails 4.1 pushing secrets to heroku

后端 未结 1 681
误落风尘
误落风尘 2020-12-15 09:29

Rails 4.1.0.beta1 and Devise.

I\'m trying to remove all of my keys from version control and I\'ve upgraded to Rails 4.1 to give this new secrets.yml a shot

T

相关标签:
1条回答
  • 2020-12-15 09:36

    You've likely got secrets.yml added to your .gitignore. Which makes sense, since you put secret keys in it -- but since Heroku deployment uses git, it never sees your secrets.yml.

    One solution is to use the heroku_secrets gem - See https://stackoverflow.com/a/22458102/2831572 .

    Another solution is to add secrets.yml to git (i.e. remove it from .gitignore) after replacing all sensitive keys with references to environment variables.
    So:

    production:
      devise_secret_key: <%= ENV['DEVISE_KEY'] %>
    

    then run heroku config:set DEVISE_KEY='7658699e0f765e8whatever'

    0 讨论(0)
提交回复
热议问题