How to reload secrets.yml without restart rails server, like if I manually update secrets.yml credentials on updating it will auto load to the rails application
eg in secrets.yml
api_key: 1111111111
In the application, I can access using
puts Rails.application.secrets.api_key
=> '1111111111'
for example, if I manually update secrets.yml file
api_key: 222222222
In the application, the result should have to be this
puts Rails.application.secrets.api_key
=> '222222222'
Without restarting server
You should be able to add a line to your config/spring.rb:
Spring.watch "config/secrets.yml"
This will allow Spring to detect when changes have occurred in your secrets.yml file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.