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

前端 未结 8 1870
野趣味
野趣味 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 17:05

    I ran into this problem when deploying my rails app to dokku using a Dockerfile. My solution:

    the file config/secrets.yml references an environment variable:

    production:
      secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
    

    I need to set this variable using the dokku command line (either directly on the server, or using the dokku-cli gem on my development machine):

    dokku config:set SECRET_KEY_BASE=blalbalblablahblablah
    

提交回复
热议问题