问题描述
我正在尝试从 github 克隆一个 rails 存储库,但它没有 secrets.yml 文件.当我尝试从 rails 服务器运行应用程序时,出现错误
缺少用于开发"环境的secret_key_base
,请在config/secrets.yml
我知道文件的结构应该是什么样子,但有没有办法生成密钥以使用开发环境?
这个 rake 任务为你生成秘密:
bundle exec rake secret
生成一个加密安全的密钥(这通常是用于为 cookie 会话生成秘密)
所有佣金任务:
bundle exec rake -T
secrets.yml 文件(注意缩进):
开发:secret_key_base: d140269c106b6d064cdd670a5aace0bbbb1400de545377a47836dbdab8104f2fdf0ab87e6b7982819d1bcc2ccf6a5f093959530a0808100a08b08080810b080a08b080a0808810b90a08b080810a0808b0808088080810a08e608b08100810081008100800080808375a0836some_key: 338a3312d82some_secret: f5d9c3214e7bother_environment:开发other_password:密码生产:secret_key_base: d140269c106b6d064cdd670a5aace0bbbb1400de545377a47836dbdab8104f2fdf0ab87e6b7982819d1bcc2ccf6a5f093959530a0808100a08b08080810b080a08b080a0808810b90a08b080810a0808b0808088080810a08e608b08100810081008100800080808375a0836some_key: 338a3312d82some_secret: f5d9c3214e7bother_environment:开发other_password:密码
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 secret_key_base
for 'development' environment, set this value in config/secrets.yml
I know what the structure of the file is supposed to look like, but is there a way for me to generate keys to use the development environment?
This rake task generate secret for you:
bundle exec rake secret
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
这篇关于生成一个新的 secrets.yml 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!