简体   繁体   English

重新加载secrets.yml不起作用

[英]Reload the secrets.yml doesn't work

I used config/secrets.yml in rails application. 我在rails应用程序中使用了config / secrets.yml

I added some api keys. 我添加了一些api密钥。 and then run rails c , then run the following to get secrets values: 然后运行rails c ,然后运行以下命令获取机密值:

Rails.application.secrets

But I find the old values in secrets.yml file. 但我在secrets.yml文件中找到旧值。

Example: 例:

My old values in secrets.yml was: 我在secrets.yml中的旧值是:

development:
   secret_key_base: 3b7cd727ee24e8444053437c36cc66c3
   email_password: 'old@password'

Then I added the following values to be as the following: 然后我添加以下值如下:

development:
   secret_key_base: 3b7cd727ee24e8444053437c36cc66c3
   email_password: 'old@password'
   admin_password: 'admin@password'

Then run Rails.application.secrets , the output is: 然后运行Rails.application.secrets ,输出为:

{:secret_key_base=>"3b7cd727ee24e8444053437c36cc66c3", :email_password=>"old@password"}

Without the attribute admin_password . 没有属性admin_password

How can I reload the secrets.yml file to update the secrets value ? 如何重新加载secrets.yml文件以更新机密值? or How I update rails application configration to load the secrets.yml file when restart server, and rails console ? 或者我如何更新rails应用程序configration以在重新启动服务器和rails console时加载secrets.yml文件?

I post this answer depend on @FabKremer comment on question. 我发布这个答案取决于@FabKremer对问题的评论。

To solve this issue.I needed to reload the spring server by the following: 解决这个问题。我需要通过以下方式重新加载spring服务器:

bin/spring stop

For more details, read this answer . 有关详细信息,请阅读此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM