Rails: How to fix “Missing secret_key_base for 'production' environment”

前端 未结 8 1831
野趣味
野趣味 2020-12-15 16:33

I simply can\'t get past the message:

Missing `secret_key_base` for \'production\' environment, set this string with `rails credentials:edit` (ArgumentError)         


        
8条回答
  •  粉色の甜心
    2020-12-15 17:05

    Secret_key_base isn't properly setting. It's a known issue not getting enough attention: https://github.com/rails/rails/issues/32947

    Generate the keys with:

    EDITOR=vim rails credentials:edit
    

    Record the key. Save in config/master.key.

    SECRET_KEY_BASE=`cat config/master.key` bin/rails assets:precompile
    

    This is the solution I came to. I really don't like how I've been forced to put it though an environment variable. If someone has more information to bring to my attention on how master.key and such work, please do comment.

提交回复
热议问题