Generating a new secrets.yml file

后端 未结 2 1700
萌比男神i
萌比男神i 2021-02-20 06:36

I\'m trying to clone a rails repository from github, but it doesn\'t have a secrets.yml file. When I try to run the app from rails server, I get the error

Missing

2条回答
  •  春和景丽
    2021-02-20 07:26

    This rake task generate secret for you:

    bundle exec rake secret
    

    Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)

    All rake tasks:

    bundle exec rake -T 
    

    The secrets.yml file(note the indentation):

    development:
      secret_key_base: d140269c106b6d064cdd670a5aace0bbbb1400de545377a47836dbdab8104f2fdf0ab87e6b7982819d1bcc2ccf6a5f093985a0895970f01f30b0b15378a090e9
      some_key: 338a3312d82
      some_secret: f5d9c3214e7b
      other_environment: development
      other_password: password
    
    production:
      secret_key_base: d140269c106b6d064cdd670a5aace0bbbb1400de545377a47836dbdab8104f2fdf0ab87e6b7982819d1bcc2ccf6a5f093985a0895970f01f30b0b15378a090e9
      some_key: 338a3312d82
      some_secret: f5d9c3214e7b
      other_environment: development
      other_password: password
    

提交回复
热议问题