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

前端 未结 8 1829
野趣味
野趣味 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:45

    config/credentials.yml.enc:

    development:
      some_username: XXXXXXXXX
      some_password: YYYYYYYYY
    
    test:
      some_username: XXXXXXXXX
      some_password: YYYYYYYYY
    
    production:
      some_username: XXXXXXXXX
      some_password: YYYYYYYYY
    
    secret_key_base: ZZZZZZZZZ
    # `secret_key_base:` must NOT be indented !
    # It must be put at the very start of a new line.
    # There is also no need for it in development or test environment,
    #   since there are no attacks to be expected.
    

    Also make sure that you respect all YAML indention rules (i.e. 2 spaces only) as failing to do so my make loading of this file fail silently.

提交回复
热议问题