Devise Secret Key was not set

前端 未结 16 1221
别那么骄傲
别那么骄傲 2020-11-27 14:53

I am developing a Rails 4 app using the Active Admin gem for the administration back end. Active Admin in turn uses Devise for user authentication. Now, when I try to deploy

16条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 15:28

    Fix:

    1. In the production server:

      sudo -H nano /etc/environment
      
    2. Then in the file add:

      export SECRET_KEY_BASE="yourkey"
      export DEMO03_DATABASE_PASSWORD="yourpass"
      

      to set this permanently, and system wide (all users, all processes) add set variable

    3. In the local project devise.rb file:

      config.secret_key = ENV["SECRET_KEY_BASE"] if Rails.env.production?
      

    Technical details:

    • Ubuntu 16.04
    • Devise (4.2.0)
    • rails 5.0.1
    • capistrano (3.7.1)

提交回复
热议问题