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

前端 未结 8 1867
野趣味
野趣味 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 16:44

    Keep default the secrets.yml file

    # config/secrets.yml
    production:
      secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
    
    RAILS_ENV=production SECRET_KEY_BASE=production_test_key rails c
    

    If using Rails 5.2.0, add to production env below, check this LINK

    config.require_master_key = true    #config/environments/production.rb
    

提交回复
热议问题