Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Ruby on Rails secrets.yml not loading?

Tags:

I am trying to access my secret keys from the config/secrets.yml file.

secrets.yml:

development:   secret_key_base: laksjfla...alskdfjlaksjdflaksd   other_secret: password 

Rails Console:

$ rails c > Rails.application.secrets > => {:secret_key_base=>"laksjfla...alskdfjlaksjdflaksd"} 

Where is my other_secret?!

like image 843
sealocal Avatar asked Oct 11 '14 02:10

sealocal


1 Answers

I've faced a similar problem once, try to reload spring server with bin/spring stop, so the changes to secrets.yml should take effect. then run rails c again. (posting comment as a answer).

There is an open pull request here - https://github.com/rails/spring/pull/289 - spring does not watch for changes in secrets.yml by default. One of the comments says:

new version of gem (spring) still wasn't released, so you can pull it from github or add Spring.watch "config/secrets.yml" to your config/spring.rb meanwhile

like image 190
Michael Radionov Avatar answered Oct 27 '22 22:10

Michael Radionov